/* TPE à jour: brand green, navy and mist (see BRAND.md), Bricolage Grotesque, mobile first. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/brand/fonts/BricolageGrotesque-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --brand-green: #16754B;
  --brand-navy: #14213D;
  --brand-mist: #F4F7F5;
  --font-brand: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: var(--brand-mist);
  --surface: #ffffff;
  --surface-2: #e9efeb;
  --ink: var(--brand-navy);
  --muted: #536159;
  --line: #d4ddd8;
  --accent: var(--brand-green);
  --accent-hover: #11603d;
  --accent-ink: #ffffff;
  --accent-soft: #e0f0e7;
  --good: var(--brand-green); --good-soft: #e0f0e7;
  --warn: #9a4700; --warn-soft: #fdeed9;
  --crit: #b42318; --crit-soft: #fde8e6;
  --info: #1d5c99; --info-soft: #e3eef8;
  --bubble-mine: #d9efe3;
  --shadow: 0 1px 2px rgba(21, 32, 26, .06), 0 6px 20px rgba(21, 32, 26, .06);
  --focus: #1d5c99;
  --font-display: var(--font-brand);
  --font-body: var(--font-brand);
  --fs-0: 13px; --fs-1: 15px; --fs-2: 17px; --fs-3: 20px; --fs-4: 26px; --fs-5: 34px;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513; --surface: #18201c; --surface-2: #212b26; --ink: #e6ede9; --muted: #9eada5; --line: #2d3833;
    --accent: #3dbe85; --accent-hover: #5fd09c; --accent-ink: #06140d; --accent-soft: #163a2a;
    --good: #3dbe85; --good-soft: #163a2a; --warn: #f0a35b; --warn-soft: #3a2a17; --crit: #f2857b; --crit-soft: #3d1e1b;
    --info: #86b8ea; --info-soft: #172a3d; --bubble-mine: #1d4532; --shadow: 0 1px 2px rgba(0,0,0,.4); --focus: #86b8ea;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513; --surface: #18201c; --surface-2: #212b26; --ink: #e6ede9; --muted: #9eada5; --line: #2d3833;
  --accent: #3dbe85; --accent-hover: #5fd09c; --accent-ink: #06140d; --accent-soft: #163a2a;
  --good: #3dbe85; --good-soft: #163a2a; --warn: #f0a35b; --warn-soft: #3a2a17; --crit: #f2857b; --crit-soft: #3d1e1b;
  --info: #86b8ea; --info-soft: #172a3d; --bubble-mine: #1d4532; --shadow: 0 1px 2px rgba(0,0,0,.4); --focus: #86b8ea;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: var(--fs-2); line-height: 1.5; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: var(--fs-5); font-weight: 800; }
h2 { font-size: var(--fs-4); font-weight: 800; }
h3 { font-size: var(--fs-3); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-1); }
.tiny { font-size: var(--fs-0); }
.num { font-variant-numeric: tabular-nums; }
.label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: var(--fs-0); font-weight: 600; color: var(--muted); }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.hero-logo { height: 64px; width: auto; }
.topbar .spacer { flex: 1; }
.mode { font-size: var(--fs-0); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.flash { max-width: 720px; margin: 12px auto 0; padding: 12px 16px; border-radius: var(--radius); background: var(--crit-soft); color: var(--crit); font-weight: 700; }

.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 24px; }
.page.narrow { max-width: 720px; }
.page-head { display: grid; gap: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: var(--radius); border: 2px solid transparent; font-weight: 700; font-size: var(--fs-2); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--muted); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: var(--fs-1); }
.btn-big { white-space: normal; text-align: center; max-width: 100%; min-height: 56px; padding: 14px 28px; font-size: var(--fs-3); border-radius: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Forms */
.form { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .field legend { font-weight: 700; }
.field .hint { color: var(--muted); font-size: var(--fs-1); }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.input-short { max-width: 160px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
fieldset { border: 0; padding: 0; margin: 0; }
.sectors { display: grid; gap: 8px; }
.sector-option { position: relative; display: grid; align-content: start; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.sector-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sector-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sector-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.sector-option .t { font-weight: 700; font-size: var(--fs-1); line-height: 1.3; display: flex; align-items: center; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.error-box { padding: 12px 14px; border-radius: var(--radius); background: var(--crit-soft); color: var(--crit); font-size: var(--fs-1); display: grid; gap: 8px; }

/* Banners and cards */
.banner { display: grid; gap: 12px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.banner[hidden] { display: none; }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.info { background: var(--info-soft); border-color: transparent; }
.banner.good { background: var(--good-soft); border-color: transparent; }
.banner .t { font-weight: 700; font-size: var(--fs-3); font-family: var(--font-display); display: flex; align-items: center; gap: 8px; }
.paper { background: #ffffff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); overflow-x: auto; }
.section { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.work { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 28px 16px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drafting-progress { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Landing pages */
.landing .hero { background: var(--surface); border-bottom: 1px solid var(--line); }
.landing .hero .page { padding-top: 40px; padding-bottom: 40px; gap: 18px; justify-items: start; }
.landing .hero h1 { font-size: clamp(32px, 7vw, 48px); }
.landing .kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.landing .page > * { min-width: 0; max-width: 100%; }
.lead { font-size: var(--fs-3); line-height: 1.45; }
.reassure { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; }
.reassure .icon { margin-top: .2em; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.how li { counter-increment: how; display: grid; grid-template-columns: 30px 1fr; align-content: start; align-items: center; gap: 10px 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how li::before { content: counter(how); width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; }
.how b { line-height: 1.25; }
.how span { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-1); }
.risk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.risk-list li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.risk-list li > span:last-child { display: grid; gap: 2px; }
.risk-list .risk-icon { color: var(--warn); }
.start-form { scroll-margin-top: 80px; }

/* Interview chat: compact, because the keyboard takes half of a phone screen. */
body.in-chat { overflow: hidden; }
.chat-shell { height: 100dvh; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); }
.chat-logo { display: flex; }
.chat-logo .brand-mark { width: 28px; height: 28px; }
.chat-title { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps-bar { padding: 6px 16px 8px; background: var(--surface); border-bottom: 1px solid var(--line); display: grid; gap: 5px; }
.steps-segments { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; max-width: 760px; width: 100%; justify-self: center; }
.steps-segments li { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); transition: background .3s ease; }
.steps-segments li.done { background: var(--accent); }
.steps-segments li.current { background: var(--accent); opacity: .55; }
.steps-label { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-0); color: var(--muted); max-width: 760px; width: 100%; justify-self: center; }
.steps-label b { color: var(--ink); font-size: var(--fs-1); }
.messages { overflow-y: auto; padding: 12px 16px 8px; }
.messages-inner { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: min(560px, 88%); padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.bubble.theirs { align-self: flex-start; background: var(--surface); border-top-left-radius: 4px; }
.bubble.mine { align-self: flex-end; background: var(--bubble-mine); border-top-right-radius: 4px; }
.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 12px 14px; background: var(--surface); border-radius: 14px; border-top-left-radius: 4px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer-area { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; }
/* Quick replies: always one line, scroll sideways if needed. */
.chips { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 760px; width: 100%; margin: 0 auto; }
.chips::-webkit-scrollbar { display: none; }
.chip-form { display: contents; }
.chip { flex: none; min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 700; font-size: var(--fs-1); cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--accent-soft); }
.composer { display: flex; align-items: flex-end; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; resize: none; padding: 10px 14px; border: 2px solid var(--line); border-radius: 22px; background: var(--bg); line-height: 1.35; }
.composer textarea:focus { border-color: var(--accent); outline: none; }
.icon { display: inline-block; flex: none; width: var(--icon-size); height: var(--icon-size); background-color: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.icon-btn.send { background: var(--accent); color: var(--accent-ink); }
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 560px) { body.in-chat { font-size: 16px; } .bubble { max-width: 92%; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Preview of a document not paid for yet: a light diagonal "Aperçu" over the page. */
.paper.is-preview { position: relative; }
.paper.is-preview::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='220'%3E%3Ctext x='50%25' y='55%25' text-anchor='middle' transform='rotate(-28 160 110)' font-family='sans-serif' font-size='44' font-weight='700' fill='%2314213d' fill-opacity='0.07'%3EAPERÇU%3C/text%3E%3C/svg%3E") repeat; }
@media print { .paper.is-preview { display: none; } }

.purchase .price { margin: 0 0 8px; font-size: 1.25rem; }
.purchase .included { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.purchase .included li { display: flex; gap: 8px; align-items: flex-start; }
.purchase .included .icon { color: var(--accent); margin-top: 2px; }

.site-footer { max-width: 960px; margin: 32px auto 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); text-align: center; }
.site-footer a { color: inherit; }
.purchase .btn, .banner .btn { white-space: normal; text-align: center; }
