/* Kainen public site (W-59, W-52b, W-52c, W-82; UX-3 round 3, MR-3 D1108–D1131, UX-5 D1214–D1228): plain, fast, no third-party fonts or scripts.
   W-82 draws the landing as the app (D1214): the app's tokens (copied from app/src/styles/theme.css; scripts/landing.test.mjs fails if they drift, D1215),
   a dot-grid canvas that scrolls with the page (D1222), floating top-bar pills, the hero map in app cards, white 12 px panels for the sections.
   WCAG AA contrast is checked by scripts/landing.test.mjs. The CSP allows no inline style, so everything lives here.
   Motion: 150 / 240 / 400 ms, cubic-bezier(0.2, 0, 0, 1), 12–16 px travel, transform and opacity only, once, never on text.
   Every page is written in its final state; `html.js` (set by lang.js only when motion is allowed) arms the start states, and with
   `prefers-reduced-motion: reduce`, without JavaScript, or when landing.js does not load, the finished page shows at once. */
:root {
  /* The app's tokens, same names and values as app/src/styles/theme.css (D1215). */
  --bg: #f8fafc; --surface: #ffffff; --soft: #eef2f6; --hover: #f1f5f9; --border: #e2e8f0; --border-2: #cbd5e1;
  --ink: #0f172a; --text: #1e293b; --text-3: #334155; --text-2: #475569; --muted: #5c6b80; --faint: #94a3b8; --on-accent: #ffffff;
  /* Steel blue (D1359+, docs/BRAND.md): the site moves first; the app follows with the ui brand pass, and the token test lists this one difference. */
  --accent: #2f5b8f; --accent-soft: #eef3f9; --accent-strong: #244a76; --accent-deep: #1b3a5e; --accent-line: #a9bfd9;
  --warn: #92400e; --warn-soft: #fffbeb; --warn-line: #fde68a; --danger: #b91c1c; --danger-soft: #fef2f2;
  --blue-tint-3: #d9dfe7; --brown-dark-2: #6b4f3a; --brown-mid-2: #9a6b4b;
  --ink-rgb: 15 23 42;
  --shadow: 0 1px 2px rgb(var(--ink-rgb) / 0.05), 0 2px 8px rgb(var(--ink-rgb) / 0.05);
  --shadow-lg: 0 8px 28px rgb(var(--ink-rgb) / 0.14);
  --r: 8px; --r-sm: 6px; --r-md: 10px; --r-pill: 999px;
  /* Site only: the 12 px radius of panels and floating bars (D1215, 727), the six type sizes (724) and the motion tokens (D1112). */
  --r-lg: 12px;
  --t-note: 14px; --t-small: 15px; --t-body: 17px; --t-lead: 20px; --t-h2: 28px; --t-h1: clamp(32px, 16px + 1.4vw, 44px);
  --m-fast: 150ms; --m-base: 240ms; --m-slow: 400ms; --ease: cubic-bezier(0.2, 0, 0, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; font: var(--t-body)/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--surface); }
a { color: var(--accent-strong); }
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { color: var(--ink); }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem; z-index: 60; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn { display: inline-block; background: var(--ink); color: var(--on-accent); font-weight: 600; padding: .7rem 1.4rem; border-radius: var(--r-md); text-decoration: none; font-size: var(--t-body); border: 1px solid var(--ink); cursor: pointer; white-space: nowrap; transition: background-color var(--m-fast), border-color var(--m-fast); }
.btn:hover { background: var(--text); border-color: var(--text); }
.btn.small { padding: .4rem .85rem; font-size: var(--t-small); }
.link-arrow { margin-left: 1.1rem; font-weight: 600; }
/* Lucide shapes inlined, 16 px in chips and 20 px large, stroke 1.75, grey (730, 731) */
.ico { flex: none; width: 16px; height: 16px; stroke: var(--text-2); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.big { width: 20px; height: 20px; }
figcaption { color: var(--muted); }
.tpl { font-weight: 600; } /* "Ouvrir ce modèle": opens the example's template in the app (?template=, D1117) */
figcaption { font-size: var(--t-note); margin-top: .6rem; }

/* Header of the legal and error pages */
header.top { border-bottom: 1px solid var(--border); background: rgb(255 255 255 / .94); position: sticky; top: 0; z-index: 5; }
header.top .wrap { display: flex; align-items: center; gap: 1.5rem; height: 60px; }
.brand { font-weight: 700; letter-spacing: .01em; color: var(--ink); text-decoration: none; font-size: var(--t-lead); margin-right: auto; }
nav.lang { font-size: var(--t-small); }

/* ---------- The landing: the app's canvas (D1214, D1222) ---------- */
body.landing { background-color: var(--bg); background-image: radial-gradient(var(--blue-tint-3) 1.2px, transparent 1.3px); background-size: 22px 22px; }

/* Top bar: the app's floating pills, kept at the top while scrolling (D1218). The bar itself is 0 px tall, so it covers nothing. */
header.bar { position: sticky; top: 12px; z-index: 20; height: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 14px; }
.pill { display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); font-size: var(--t-small); white-space: nowrap; }
.pill a:not(.btn) { color: var(--text-2); text-decoration: none; padding: 6px 0; }
.pill a:not(.btn):hover { color: var(--ink); text-decoration: underline; }
.brand-pill .brand { margin: 0; color: var(--ink); }
.brand-pill .brand:hover { text-decoration: none; }
.tagline { padding-left: 14px; border-left: 1px solid var(--border); color: var(--text-2); }
.pill.end { padding: 6px 6px 6px 14px; gap: 12px; }

/* First screen: the map on the canvas, the side panel with the headline (D1214, D1217) */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-areas: "stage side"; min-height: 740px; border-bottom: 1px solid var(--border); }
.side { grid-area: side; background: var(--surface); border-left: 1px solid var(--border); padding: 100px 32px 32px; }
.stage { grid-area: stage; position: relative; min-width: 0; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding: 96px 12px 72px; }
.eyebrow { margin: 0 0 .5rem; color: var(--muted); font-size: var(--t-note); font-weight: 600; }
.hero h1 { font-size: var(--t-h1); line-height: 1.1; margin: 0 0 .8rem; letter-spacing: -.01em; text-wrap: balance; }
.lead { font-size: var(--t-lead); line-height: 1.45; color: var(--text-2); margin: 0 0 1.4rem; }
.cta { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 0; }
.under { color: var(--muted); font-size: var(--t-note); margin: .9rem 0 0; }
.phone-only { display: none; }
.costfig { max-width: 28rem; margin-top: 1.8rem; border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px 12px; background: var(--bg); }
.fig-k { margin: 0; color: var(--muted); font-size: var(--t-note); }
.fig-v { margin: 2px 0 0; color: var(--ink); font-size: var(--t-h2); line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
.fig-y { margin: 0 0 10px; color: var(--text-2); font-size: var(--t-note); font-variant-numeric: tabular-nums; }
.bars { display: block; width: 100%; height: 52px; }
.bars .bar { fill: var(--muted); }
.bars .bar.hot { fill: var(--brown-mid-2); } /* both at least 3:1 on the panel (WCAG 1.4.11) */
.fig-n { margin: 8px 0 0; color: var(--muted); font-size: var(--t-note); }

/* Hero map: one inline SVG of app cards; it shows the finished frame and landing.js plays the build-up twice. Read-only: no hover, normal cursor (D1219).
   It is a picture of the app (its <title> carries the content), drawn no narrower than 760 px so its text stays legible (D1384, D1386: a complete slice that ends at a phase boundary; a narrower stage or a phone shows its left part). */
.hero-map { display: block; flex: none; width: max(760px, 100%); max-width: 1304px; height: auto; cursor: default; }
@media (max-width: 1180px) { .stage { justify-content: flex-start; } }
.map-ctl { display: none; position: absolute; right: 16px; bottom: 16px; min-width: 44px; min-height: 44px; padding: .35rem .9rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); font: inherit; font-size: var(--t-small); cursor: pointer; transition: border-color var(--m-fast); }
.js .map-ctl { display: block; }
.map-ctl:hover { border-color: var(--border-2); }

/* Sections: #208's HTML, each framed as an app panel in a reading column on the canvas (D1220) */
section.block { padding: 5rem 0; }
.landing section.block { width: calc(100% - 48px); max-width: 1040px; margin: 28px auto 0; padding: 36px 0 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.landing .hero + section.block { margin-top: 56px; }
.landing section.block > .wrap { max-width: none; padding: 0 40px; }
h2 { font-size: var(--t-h2); line-height: 1.2; margin: 0 0 .7rem; letter-spacing: -.005em; }
h3 { font-size: var(--t-lead); line-height: 1.3; }
.intro { color: var(--text-2); margin: 0 0 2rem; max-width: 44rem; }
.intro.tight { margin-bottom: 1.2rem; }

/* The method (789, 790): four lines of arithmetic beside one sample step worked through with its real figures. No chart, no new colour. */
.how { display: grid; grid-template-columns: 1fr 1.15fr; gap: 2.5rem; align-items: start; }
.formulas { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.formulas h3 { margin: 0 0 .15rem; font-size: var(--t-body); }
.formulas p { margin: 0; color: var(--text-2); font-size: var(--t-small); }
.calc { border-collapse: collapse; width: 100%; font-size: var(--t-small); font-variant-numeric: tabular-nums; background: var(--surface); }
.calc th, .calc td { padding: .5rem .6rem; border: 0; border-bottom: 1px solid var(--border); text-align: right; background: none; }
.calc th:first-child { text-align: left; font-weight: 400; color: var(--text); }
.calc thead th { color: var(--ink); font-weight: 600; }
.calc thead th:first-child { font-weight: 700; }
.calc td:nth-child(2) { color: var(--text-2); white-space: nowrap; }
.calc tr.total th, .calc tr.total td { font-weight: 700; color: var(--ink); border-bottom: 0; border-top: 1px solid var(--border-2); }
.calc caption { caption-side: bottom; text-align: left; padding-top: .6rem; color: var(--muted); font-size: var(--t-note); }

/* How it works: three app cards with number badges */
.steps { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; counter-reset: step; }
.steps li { position: relative; counter-increment: step; border: 1px solid var(--border); border-radius: var(--r); padding: 1rem 1rem .9rem; background: var(--surface); box-shadow: var(--shadow); }
.steps li::before { content: counter(step); position: absolute; left: -9px; top: -10px; width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--text); color: var(--on-accent); font-size: var(--t-note); font-weight: 700; line-height: 22px; text-align: center; }
.step-ico { display: inline-block; }
.steps h3 { margin: .4rem 0 .3rem; }
.steps p { margin: 0; color: var(--text-2); font-size: var(--t-small); }

/* Examples */
.example { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; padding: 2rem 0; border-top: 1px solid var(--border); }
.example:first-of-type { border-top: 0; padding-top: .5rem; }
.example:nth-of-type(even) .text { order: 2; }
.example h3 { margin: 0 0 .4rem; }
.example .text p { margin: 0; color: var(--text-2); max-width: 30rem; }
.example .text p.fig { margin: .7rem 0 0; color: var(--text); font-size: var(--t-small); font-variant-numeric: tabular-nums; }
.example:not(:has(.visual)) { grid-template-columns: 1fr; }
.visual { margin: 0; justify-self: center; width: 100%; max-width: 26rem; }
.frame { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }

/* Before and after */
.ba { max-width: 46rem; }
.switch { display: none; align-items: center; gap: .6rem; margin: 0 0 1rem; padding: .35rem .9rem .35rem .4rem; min-height: 44px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-pill); font: inherit; font-size: var(--t-small); font-weight: 600; cursor: pointer; transition: border-color var(--m-fast); }
.ui .switch { display: inline-flex; }
.switch:hover { border-color: var(--border-2); }
.knob { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--muted); transition: background-color var(--m-base) var(--ease); }
.knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform var(--m-base) var(--ease); }
.switch[aria-checked="true"] { border-color: var(--accent-line); }
.switch[aria-checked="true"] .knob { background: var(--accent); }
.switch[aria-checked="true"] .knob::after { transform: translateX(16px); }
.compare { width: 100%; border-collapse: collapse; font-size: var(--t-small); font-variant-numeric: tabular-nums; background: var(--surface); }
.compare th, .compare td { padding: .55rem .75rem; border: 0; border-bottom: 1px solid var(--border); text-align: right; background: none; transition: color var(--m-base), background-color var(--m-base), opacity var(--m-base); }
.compare th:first-child { text-align: left; font-weight: 600; color: var(--text); }
.compare thead th { color: var(--muted); font-weight: 600; font-size: var(--t-note); }
.compare td.col-gain { font-weight: 700; color: var(--accent-strong); }
.compare caption { caption-side: bottom; text-align: left; padding-top: .6rem; color: var(--muted); font-size: var(--t-note); }
.ui .ba:not(.tobe) td.col-asis, .ui .ba.tobe td.col-tobe { font-weight: 700; color: var(--ink); background: var(--accent-soft); }
.ui .ba:not(.tobe) td.col-tobe, .ui .ba.tobe td.col-asis { color: var(--muted); }
.ui .ba:not(.tobe) .col-gain { opacity: 0; }

/* Who it's for */
.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.who > div { border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.who h3 { margin: .5rem 0 .25rem; }
.who p { margin: 0; color: var(--text-2); font-size: var(--t-small); }

/* Trust: the facts as the app's chips */
.trust-row .facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.trust-row .facts li { display: flex; gap: .5rem; align-items: center; padding: .35rem .85rem .35rem .6rem; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); font-weight: 600; font-size: var(--t-small); }
.trust-links { margin: 1.2rem 0 0; font-size: var(--t-small); }
.trust-links a { margin-right: 1.2rem; }

/* FAQ */
.faq details { border-top: 1px solid var(--border); padding: 1rem 0; max-width: 46rem; }
.faq > .wrap > details:last-of-type, .faq .more > details:last-of-type { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: var(--t-lead); line-height: 1; transition: transform var(--m-fast) var(--ease); }
.faq details[open] > summary::after { transform: rotate(45deg); }
.faq details p { color: var(--text-2); margin: .55rem 0 0; max-width: 44rem; }
.faq .more { border-top: 1px solid var(--border); padding: 0; }
.faq .more > summary { padding: 1rem 0; color: var(--accent-strong); }
.faq .more > details:first-of-type { border-top: 1px solid var(--border); }

/* The doorway (D1224, D1226–D1228): the shared app picture, blurred once, with one button on a frosted plate. Text sits only on the plate (5:1 or more). */
.landing section.block.final { background: none; border: 0; box-shadow: none; padding: 0; margin: 28px auto 72px; }
.landing section.block.final > .wrap { padding: 0; }
.door { position: relative; height: 380px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow); }
.pic, .frost-pic { position: absolute; inset: -24px; filter: blur(7px); }
.pic svg, .frost-pic svg { display: block; width: 100%; height: 100%; }
.plate { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); padding: 22px 26px 18px; text-align: center; background: rgb(255 255 255 / .93); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.plate .wm { margin: 0; color: var(--text-2); font-weight: 700; font-size: var(--t-lead); }
.plate h2 { font-size: var(--t-lead); margin: .5rem 0 1rem; text-wrap: balance; }
.plate .note { margin: .7rem 0 0; color: var(--text-2); font-size: var(--t-small); }
.plate .note a { display: inline-block; padding: 4px 0; }

/* The click frost (D1225): only with html.js (motion allowed); landing.js copies the doorway's picture in. Opacity and transform only. */
.frost { display: none; }
.js .frost { display: block; position: fixed; inset: 0; z-index: 50; overflow: hidden; background: var(--bg); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--m-base) var(--ease), visibility 0s linear var(--m-base); }
.frosting .frost { opacity: 1; visibility: visible; transition: opacity var(--m-base) var(--ease); }
.frost .plate { width: auto; min-width: 240px; transform: translate(-50%, -50%) scale(.97); transition: transform var(--m-base) var(--ease); }
.frosting .frost .plate { transform: translate(-50%, -50%); }
.frost-msg { margin: .4rem 0 0; color: var(--text-2); font-size: var(--t-small); }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 2.5rem 0; color: var(--muted); font-size: var(--t-small); background: var(--surface); }
.cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.cols h2 { font-size: var(--t-small); font-weight: 600; color: var(--muted); margin: 0 0 .6rem; } /* sentence-case labels (725) */
.cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cols p { margin: .4rem 0 0; }
.cols .brand { display: inline-block; }

/* Legal and error pages */
main.page { padding: 2rem 0 3rem; }
main.page h1 { font-size: var(--t-h2); }
main.page .wrap { max-width: 52rem; }
main.page h2 { font-size: var(--t-lead); margin: 2rem 0 .5rem; }
main.page h3 { font-size: var(--t-body); margin: 1.4rem 0 .4rem; }
main.page ul, main.page ol { padding-left: 1.4rem; }
main.page li { margin: .25rem 0; }
.tablewrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--t-small); }
th, td { text-align: left; vertical-align: top; padding: .5rem .65rem; border: 1px solid var(--border); }
th { background: var(--bg); }
code { background: var(--soft); padding: 0 .25em; border-radius: var(--r-sm); font-size: .92em; }

/* Motion: start states exist only under html.js (motion allowed) and .playing; the markup is the finished state */
[data-reveal] { transition: opacity var(--m-slow) var(--ease), transform var(--m-slow) var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal]:not(.in) { opacity: 0; transform: translateY(16px); }
.hero [data-beat] { transition: opacity var(--m-base) var(--ease), transform var(--m-base) var(--ease); }
.hero-map .tint { transition-duration: var(--m-slow); }
.hero .hero-map, .hero .costfig { transition: opacity var(--m-base) var(--ease); }
.hero.fade .hero-map { opacity: 0; }
.costfig .bar { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 600ms var(--ease); }
.playing [data-beat]:not(.in) { opacity: 0; }
.playing g.card:not(.in), .playing g.chip:not(.in) { transform: translateY(12px); }
.playing path.conn { stroke-dasharray: 1; transition: stroke-dashoffset var(--m-slow) ease-in-out, opacity var(--m-fast); }
.playing path.conn:not(.in) { stroke-dashoffset: 1; }
.playing path.conn.in { stroke-dashoffset: 0; }
.playing .costfig:not(.in) .bar { transform: scaleY(0); }
@media print {
  .js [data-reveal], .playing [data-beat], .playing g.card, .playing g.chip { opacity: 1 !important; transform: none !important; }
  .playing path.conn { stroke-dashoffset: 0 !important; } .costfig .bar { transform: none !important; }
  .map-ctl, .frost, header.bar { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .map-ctl { display: none !important; } .frost { display: none !important; } * { transition-duration: 0s !important; animation-duration: 0s !important; transition-delay: 0s !important; } }

/* Layout breakpoints */
@media (min-width: 1800px) { .wrap { max-width: 80rem; } }
@media (max-width: 1180px) { .hero { grid-template-columns: minmax(0, 1fr) 380px; } .side { padding-left: 24px; padding-right: 24px; } .tagline { display: none; } }
@media (max-width: 900px) {
  nav.sections { display: none; }
  /* Phones and narrow windows: the panel first, then the map (D1221) */
  .hero { display: flex; flex-direction: column; min-height: 0; }
  .side { border-left: 0; padding: 84px 24px 28px; }
  .stage { padding: 20px 12px 68px; border-top: 1px solid var(--border); }
  .landing section.block { width: calc(100% - 24px); padding: 28px 0 32px; }
  .landing section.block > .wrap { padding: 0 22px; }
  .example { grid-template-columns: 1fr; gap: 1.2rem; }
  .example:nth-of-type(even) .text { order: 0; }
  .visual { justify-self: start; }
  .steps, .who, .how { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  header.bar { top: 8px; padding: 0 8px; }
  .pill { min-height: 44px; padding: 4px 10px; }
  .pill.end { padding: 4px 4px 4px 10px; }
  .side { padding: 72px 18px 24px; }
  /* the map as a read-only strip: drawn at a readable size and cut at the right edge */
  .stage { justify-content: flex-start; overflow: hidden; padding: 16px 0 68px 12px; }
  .hero-map { width: 960px; max-width: none; }
  .link-arrow { margin-left: 0; width: 100%; }
  .landing section.block > .wrap { padding: 0 16px; }
  .compare, .calc { font-size: var(--t-note); }
  .compare th, .compare td, .calc th, .calc td { padding: .5rem .35rem; }
  .calc td:nth-child(2) { white-space: normal; }
  .door { height: 420px; }
  .plate { padding: 18px 16px 14px; }
  .cols { grid-template-columns: 1fr; }
  .phone-only { display: block; }
}
