/* ETA — Legal site shared stylesheet
   Created by Kiye Mateus. Matches the in-app visual system. */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --ink: #07111f;
  --ink-soft: #1f2a3a;
  --muted: #5b6675;
  --line: #dde6f2;
  --line-soft: #eaf0f8;
  --blue: #1d6ff2;
  --blue-ink: #144ea6;
  --blue-soft: #eaf3ff;
  --cyan: #1296c2;
  --mint: #1f9e6c;
  --amber: #b5730a;
  --danger: #c2403a;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 18px 48px -28px rgba(13, 38, 76, 0.45);
  --maxw: 1080px;
  color-scheme: light;
}

/* Light is the default theme (same as the app, which starts in light mode).
   Dark is opt-in via the ☾ toggle — the site does NOT auto-follow the OS setting. */
html:has(#theme-dark:checked) {
  color-scheme: dark;
  --bg: #070a0f;
  --surface: #11161f;
  --surface-2: #161c27;
  --ink: #eef3fa;
  --ink-soft: #d4dde9;
  --muted: #95a3b6;
  --line: #232c3a;
  --line-soft: #1b222e;
  --blue: #5c93ff;
  --blue-ink: #9cc0ff;
  --blue-soft: rgba(92, 147, 255, 0.14);
  --cyan: #4cc6ec;
  --mint: #5fd49a;
  --amber: #f0b454;
  --danger: #ff7a72;
  --shadow: 0 22px 60px -34px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% -4%, rgba(29, 111, 242, 0.12), transparent 36%),
    radial-gradient(circle at 88% 6%, rgba(18, 150, 194, 0.10), transparent 30%),
    var(--bg);
  line-height: 1.62;
  font-size: 16px;
  letter-spacing: 0.1px;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
  text-decoration: none;
  border-radius: 4px;
}
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
label:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.page {
  width: min(var(--maxw), calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 auto;
  width: 100%;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  width: min(var(--maxw), calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 760;
  font-size: 16px;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: block;
}
.brand span small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
}
nav.primary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
nav.primary a {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 620;
  padding: 7px 11px;
  border-radius: 999px;
}
nav.primary a:hover { background: var(--blue-soft); text-decoration: none; }
nav.primary a[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue-ink);
}

/* ---------- Language switch (pure CSS, no JS) ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.langswitch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
}
.langswitch label {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--muted);
  user-select: none;
}
html:has(#lang-fr:checked) label[for="lang-fr"],
html:has(#lang-en:checked) label[for="lang-en"],
html:has(#theme-light:checked) label[for="theme-light"],
html:has(#theme-dark:checked) label[for="theme-dark"] {
  background: var(--blue);
  color: #fff;
}
.langswitch label { display: inline-flex; align-items: center; justify-content: center; }
.themeswitch label { padding: 6px 9px; }
.themeswitch label svg,
.ico svg { display: block; }
/* Toggle which language is visible */
html:has(#lang-en:checked) [data-lang="fr"] { display: none; }
html:has(#lang-fr:checked) [data-lang="en"] { display: none; }

/* ---------- Hero ---------- */
.hero {
  margin-top: 26px;
  padding: clamp(26px, 5vw, 52px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--blue-ink);
  background: var(--blue-soft);
  padding: 6px 12px;
  border-radius: 999px;
}
.hero h1 {
  margin: 18px 0 0;
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.5px;
  font-weight: 800;
}
.hero .lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 19px);
}
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-size: 13px;
  font-weight: 700;
}
.updated {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
  margin-top: 20px;
}

/* ---------- Cards grid (hub) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.card {
  display: block;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  box-shadow: var(--shadow);
}
.card .ico {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-size: 20px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .go {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
}

/* ---------- Document layout ---------- */
.doc {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 28px;
  margin-top: 26px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 92px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toc h2 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 560;
  counter-increment: toc;
}
.toc a::before {
  content: counter(toc) ". ";
  color: var(--muted);
  font-weight: 700;
}
.toc a:hover { background: var(--blue-soft); text-decoration: none; }

article.doc-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 44px);
  box-shadow: var(--shadow);
}
article.doc-body > section { scroll-margin-top: 92px; }
article.doc-body > section + section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
}
article.doc-body h2 {
  margin: 0 0 14px;
  font-size: clamp(20px, 3vw, 25px);
  letter-spacing: -0.3px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
article.doc-body h2 .num {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
article.doc-body h3 {
  margin: 22px 0 8px;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}
article.doc-body p { margin: 0 0 12px; color: var(--ink-soft); }
article.doc-body p:last-child { margin-bottom: 0; }
article.doc-body strong { color: var(--ink); font-weight: 700; }
article.doc-body ul,
article.doc-body ol.lower {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--ink-soft);
}
article.doc-body li + li { margin-top: 7px; }
article.doc-body dl { margin: 0; }
article.doc-body dt { font-weight: 700; color: var(--ink); margin-top: 14px; }
article.doc-body dd { margin: 4px 0 0; color: var(--muted); }

.notice {
  border-left: 4px solid var(--blue);
  background: var(--surface-2);
  padding: 16px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
}
.notice.warn { border-left-color: var(--amber); }
.notice p { color: var(--ink-soft); }
.notice strong { color: var(--ink); }

.kv {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 14px 0;
}
.kv .row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14.5px;
}
.kv .row + .row { border-top: 1px solid var(--line-soft); }
.kv .row span:first-child { color: var(--muted); font-weight: 650; }
.kv .row span:last-child { color: var(--ink); }

.small { font-size: 13.5px; color: var(--muted); }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 650;
  margin-top: 8px;
}

/* ---------- FAQ ---------- */
details.faq {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 18px;
  margin: 10px 0;
  background: var(--surface);
}
details.faq + details.faq { margin-top: 10px; }
details.faq summary {
  cursor: pointer;
  list-style: none;
  font-weight: 680;
  padding: 14px 0;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+";
  color: var(--blue);
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
}
details.faq[open] summary::after { content: "–"; }
details.faq .answer { padding: 0 0 16px; color: var(--ink-soft); }
details.faq .answer p:first-child { margin-top: 0; }

/* ---------- Footer ---------- */
footer.site-footer {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}
footer.site-footer .cols {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
footer.site-footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
footer.site-footer a { color: var(--ink-soft); font-weight: 600; }
footer.site-footer .legalrow { margin-top: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .doc { grid-template-columns: 1fr; }
  .toc { position: static; top: auto; }
  .toc ol { columns: 2; column-gap: 16px; }
  .cards { grid-template-columns: 1fr; }
}

/* Tablet / large phone: let the header wrap instead of overflowing,
   and stack the key/value tables. */
@media (max-width: 680px) {
  html { scroll-padding-top: 116px; }
  .site-header .inner { flex-wrap: wrap; row-gap: 8px; padding: 10px 0; }
  nav.primary { gap: 4px; justify-content: flex-end; }
  nav.primary a { padding: 6px 9px; font-size: 13px; }
  .kv .row { grid-template-columns: 1fr; gap: 3px; padding: 12px 14px; }
  .kv .row span:last-child { text-align: left; }
}

@media (max-width: 540px) {
  .toc ol { columns: 1; }
}

/* Phone: collapse the text links, but ALWAYS keep the FR/EN + ☀/☾ switches. */
@media (max-width: 480px) {
  nav.primary > a { display: none; }
  nav.primary { width: auto; margin-left: auto; }
  .hero { border-radius: 24px; }
  article.doc-body h2 { font-size: 20px; }
}

/* ---------- Print ---------- */
@media print {
  html:has(#theme-dark:checked) {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-soft: #1a1a1a;
    --muted: #444; --line: #ccc; --line-soft: #e6e6e6; --blue: #0a4ea6; --blue-ink: #0a3a7a;
  }
  .site-header, footer.site-footer, .toc, .langswitch, .themeswitch, .meta, nav.primary { display: none !important; }
  html:has(#lang-en:checked) [data-lang="fr"],
  html:has(#lang-fr:checked) [data-lang="en"] { display: revert; }
  [data-lang="en"] { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  article.doc-body, .hero { box-shadow: none; border: none; padding: 0; }
  .doc { display: block; }
  a { color: #000; text-decoration: underline; }
}
