/* Legaphil — feuille de style unique, sans framework */

:root {
  --paper: #f7f4ee;
  --card: #ffffff;
  --ink: #16202e;
  --ink-soft: #4a5566;
  --line: #e2ddd3;
  --accent: #0d5c6b;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0f1;
  --green: #1d7a4b;  --green-soft: #e6f3ec;
  --amber: #a8640d;  --amber-soft: #fbf0dc;
  --red: #b42318;    --red-soft: #fbe8e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 4px 16px rgba(22, 32, 46, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Hiragino Sans", "Noto Sans CJK JP", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color-scheme: light;
}
:lang(ja) { --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", "Noto Sans CJK JP", Meiryo, sans-serif; }
:lang(ko) { --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11161d; --card: #19202a; --ink: #e8ebef; --ink-soft: #a5afbd; --line: #2b3441;
    --accent: #5fb6c4; --accent-ink: #0b1218; --accent-soft: #1a2f35;
    --green: #5cc391; --green-soft: #15291f; --amber: #e7aa55; --amber-soft: #2e2416;
    --red: #f2786d; --red-soft: #33191a;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11161d; --card: #19202a; --ink: #e8ebef; --ink-soft: #a5afbd; --line: #2b3441;
  --accent: #5fb6c4; --accent-ink: #0b1218; --accent-soft: #1a2f35;
  --green: #5cc391; --green-soft: #15291f; --amber: #e7aa55; --amber-soft: #2e2416;
  --red: #f2786d; --red-soft: #33191a;
  --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.55;
  overflow-wrap: anywhere;
}
:lang(ja) body, :lang(ko) body { line-height: 1.7; word-break: normal; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h2:focus { outline: none; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- en-tête ---------- */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 16px; font-weight: 800; flex: none; line-height: 1;
}
.brand > span:last-child { min-width: 0; }
@media (max-width: 520px) { .site-head .brand small { display: none; } }
.brand small { display: block; font-weight: 500; color: var(--ink-soft); font-size: 12px; letter-spacing: 0; }
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; cursor: pointer; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; background: var(--card); white-space: nowrap;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 150px;
}
.lang-switch a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.lang-switch a:hover { background: var(--accent-soft); }
.lang-switch a[aria-current="true"] { font-weight: 700; color: var(--accent); }

/* ---------- accueil ---------- */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(28px, 6vw, 40px); letter-spacing: -.02em; }
.hero p { color: var(--ink-soft); margin: 12px 0 0; max-width: 60ch; }
.search { margin: 24px 0 8px; position: relative; }
.search input {
  width: 100%; padding: 14px 16px 14px 44px; font: inherit; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
}
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.cat { margin: 28px 0; }
.cat h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 10px; }
.cards { display: grid; gap: 10px; }
.card {
  display: block; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { font-size: 18px; }
.card p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }
.card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.chip { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.empty { color: var(--ink-soft); padding: 16px 0; }

/* ---------- page scénario ---------- */
.intro { padding: 32px 0 8px; }
.intro .kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 0 0 8px; }
.intro h1 { font-size: clamp(26px, 5.5vw, 36px); letter-spacing: -.02em; }
.intro .lead { color: var(--ink-soft); margin: 12px 0 0; }
.intro .verified { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.notice { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--ink); font-size: 15px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 14px 24px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px; cursor: pointer;
}
.btn-primary:disabled { opacity: .5; cursor: progress; }
.is-running .intro .btn-primary, .is-running .intro .lead { display: none; }

#stage:empty { display: none; }
.screen { margin: 16px 0 32px; }
.crumbs { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.crumbs li { padding: 3px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink-soft); }
.step { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.screen-q h2 { font-size: clamp(21px, 4.5vw, 26px); margin-bottom: 18px; }

.options { display: grid; gap: 10px; }
.option {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 16px 48px 16px 18px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .12s, background .12s;
}
.option:hover { border-color: var(--accent); }
.option:active { background: var(--accent-soft); }
.option-label { display: block; font-weight: 650; font-size: 17px; }
.option-sub { display: block; color: var(--ink-soft); font-size: 14.5px; margin-top: 2px; }
.option-arrow { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 20px; }

.nav-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn-ghost, .btn-small {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; font-size: 14.5px;
}
.btn-ghost:hover, .btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 6px 12px; font-size: 13.5px; background: var(--card); white-space: nowrap; flex: none; }
.is-done { border-color: var(--green) !important; color: var(--green) !important; }

/* ---------- résultat ---------- */
.screen-r { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 18px; box-shadow: var(--shadow); border-top-width: 6px; }
.badge-GREEN { border-top-color: var(--green); }
.badge-YELLOW { border-top-color: var(--amber); }
.badge-RED { border-top-color: var(--red); }
.r-head { margin-bottom: 18px; }
.r-head h2 { font-size: clamp(21px, 4.5vw, 27px); margin-top: 10px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.pill-GREEN { background: var(--green-soft); color: var(--green); }
.pill-YELLOW { background: var(--amber-soft); color: var(--amber); }
.pill-RED { background: var(--red-soft); color: var(--red); }
.sev { margin-left: 8px; font-size: 14px; color: var(--ink-soft); }

.facts { display: grid; gap: 10px; margin: 0 0 8px; }
@media (min-width: 620px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts div { background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.facts dt { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.facts dd { margin: 4px 0 0; font-weight: 600; }

.block { margin-top: 22px; }
.block h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 10px; }
.block ul, .block ol { margin: 0; padding-left: 0; list-style: none; }
.block-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; margin-bottom: 10px; }
.block-title-row h3 { margin: 0; }

.rules li { position: relative; padding: 10px 12px 10px 38px; border-radius: 10px; background: var(--paper); margin-bottom: 6px; font-weight: 550; }
.rules li::before { content: "!"; position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--card); font-size: 12px; font-weight: 800; display: grid; place-items: center; }

.actions { counter-reset: act; }
.actions li { counter-increment: act; position: relative; padding: 2px 0 14px 46px; }
.actions li::before {
  content: counter(act); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center;
}
.actions strong { display: block; }
.actions span { display: block; color: var(--ink-soft); font-size: 15.5px; margin-top: 2px; }

.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.checklist label { cursor: pointer; }
.checklist input:checked + label { color: var(--ink-soft); text-decoration: line-through; }

.flags li { position: relative; padding: 10px 12px 10px 38px; margin-bottom: 6px; border-radius: 10px; background: var(--red-soft); }
.flags li::before { content: "⚠"; position: absolute; left: 12px; top: 9px; color: var(--red); }

.myth { padding: 12px 14px; border-left: 3px solid var(--line); margin-bottom: 10px; }
.myth p { margin: 0 0 6px; }
.myth p:last-child { margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-right: 8px; padding: 1px 7px; border-radius: 6px; }
.tag-myth { background: var(--red-soft); color: var(--red); text-decoration: line-through; }
.tag-real { background: var(--green-soft); color: var(--green); }

.block-legal summary { cursor: pointer; font-size: 15px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.block-legal ul { margin-top: 10px; font-size: 15px; }
.block-legal li { padding: 4px 0; }
.terms-note { font-size: 13.5px; color: var(--ink-soft); margin: 16px 0 0; }

/* ---------- contenu statique (SEO) ---------- */
.covered { margin: 32px 0; }
.covered summary { cursor: pointer; font-weight: 700; }
.covered ul { padding-left: 0; list-style: none; margin: 12px 0 0; }
.covered li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; transform: translateY(1px); }
.dot-GREEN { background: var(--green); } .dot-YELLOW { background: var(--amber); } .dot-RED { background: var(--red); }
.sources { font-size: 15px; }
.sources ul { padding-left: 18px; }
.disclaimer { margin: 28px 0; padding: 16px; border-radius: 12px; background: var(--accent-soft); font-size: 15px; }
.disclaimer strong { display: block; margin-bottom: 4px; }
.error { padding: 16px; background: var(--red-soft); border-radius: 12px; }

/* ---------- documents à remplir ---------- */
.head-tools { display: flex; align-items: center; gap: 8px; }
.nav-docs { padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--accent); background: var(--accent-soft); white-space: nowrap; }
.nav-docs:hover { background: var(--accent); color: var(--accent-ink); }
.chip-doc { background: var(--amber-soft); color: var(--amber); }
.card-doc { border-left: 4px solid var(--amber); }
.doc-callout { margin: 24px 0; padding: 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--amber); box-shadow: var(--shadow); }
.doc-callout .kicker { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--amber); margin: 0 0 6px; }
.doc-callout h2 { font-size: 19px; }
.doc-callout p { color: var(--ink-soft); margin: 6px 0 0; font-size: 15px; }
.doc-callout .btn-primary { margin-top: 14px; font-size: 15.5px; padding: 11px 20px; text-decoration: none; }

.wrap-wide { max-width: 1180px; }
.doc-layout { display: grid; gap: 24px; margin: 20px 0 8px; align-items: start; }
@media (min-width: 980px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .doc-right { position: sticky; top: 12px; }
}
.doc-layout h2 { font-size: 20px; }
.doc-layout > section > .hint { margin: 6px 0 12px; }
.doc-form { display: grid; gap: 14px; }
.doc-group { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); min-width: 0; }
.doc-group legend { font-weight: 750; font-size: 16px; padding: 0 6px; }
.doc-group > .hint { margin: 2px 0 6px; }
.field { display: grid; gap: 6px; margin-top: 12px; }
.field[hidden] { display: none; }
.field label { font-weight: 600; font-size: 15px; }
.req { color: var(--red); }
.field input:not([type="checkbox"]), .field select, .field textarea {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-check { grid-template-columns: auto 1fr; align-items: start; column-gap: 10px; }
.field-check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.field-check .hint, .field-check .field-error { grid-column: 1 / -1; }
.hint { font-size: 13.5px; color: var(--ink-soft); margin: 0; }
.field-error { font-size: 13.5px; color: var(--red); margin: 0; font-weight: 600; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red) !important; }
.minor-notice { font-size: 14px; }
.doc-actions { position: sticky; bottom: 0; z-index: 5; margin-top: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(22, 32, 46, .08); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.doc-actions .btn-primary { margin: 0; }
.doc-summary { margin: 0; flex: 1 1 100%; font-size: 14.5px; font-weight: 600; }
.doc-summary.is-pending { color: var(--amber); }
.doc-summary.is-ready { color: var(--green); }
.doc-status { margin: 0; font-size: 14px; color: var(--ink-soft); flex: 1 1 100%; }
.doc-status:empty { display: none; }
.doc-paper { background: #fff; color: #17202d; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 34px 30px; max-height: 80vh; overflow: auto; }
.doc-preview { font-family: "DejaVu Serif", Georgia, "Times New Roman", serif; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.doc-preview p { margin: 0 0 9px; }
.doc-preview h3 { font-size: 13.5px; margin: 16px 0 6px; }
.pv-title { font-size: 18px; text-align: center; letter-spacing: .02em; }
.pv-sub { text-align: center; color: #5b6573; font-size: 12px; margin-bottom: 18px !important; }
.pv-center { text-align: center; }
.pv-right { text-align: right; }
.pv-li { padding-left: 26px; text-indent: -22px; }
.pv-li span { display: inline-block; width: 22px; text-indent: 0; }
.pv-kv { border-collapse: collapse; margin: 4px 0 12px 20px; }
.pv-kv th { text-align: left; font-weight: normal; color: #5b6472; padding: 1px 12px 1px 0; vertical-align: top; white-space: nowrap; }
.pv-kv td { padding: 1px 0; vertical-align: top; }
.pv-break { border: 0; border-top: 1px dashed #b9b3a7; margin: 28px 0; }
.pv-note { color: #5b6573; font-size: 11.5px; margin-top: 18px !important; }
.pv-sig { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 28px 0 6px; }
.pv-sig > div { display: grid; gap: 2px; }
.pv-line { display: block; border-top: 1px solid #17202d; margin-bottom: 4px; }
.pv-sig small { color: #5b6573; font-size: 11px; }
.doc-preview mark.missing { background: #fff1c2; color: #7a4a00; border-radius: 3px; padding: 0 2px; }
@media (max-width: 560px) { .doc-paper { padding: 22px 16px; } .pv-sig { gap: 16px; } }

/* ---------- pied de page ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 40px; font-size: 14px; color: var(--ink-soft); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }

/* ---------- impression ---------- */
@media print {
  .site-head, .site-foot, .nav-row, .btn-small, .crumbs, .covered, .intro .lead, .notice, .doc-callout, .doc-left, .doc-actions { display: none !important; }
  .doc-paper { max-height: none; overflow: visible; box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; font-size: 12pt; }
  .screen-r { box-shadow: none; border: 1px solid #999; }
  .block-legal { display: block; } .block-legal ul { display: block; }
  details.block-legal > summary { list-style: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.docs-all { margin: 18px 0 0; }

/* ---------- résultats de recherche ---------- */
.results { margin: 8px 0 28px; }
.results-head { font-size: 14px; color: var(--ink-soft); margin: 0 0 10px; }
.results-tip { font-size: 15px; color: var(--ink-soft); margin: 0; }
.card .snippet { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--paper); font-size: 14.5px; color: var(--ink); }
.card mark { background: var(--amber-soft); color: inherit; padding: 0 2px; border-radius: 3px; font-weight: 600; }
