/* ==========================================================================
   Folane Patrimoine — feuille de styles
   Identité : marine (issu du monogramme FP) + neutres chauds + laiton discret
   Aucune ressource externe : polices système uniquement (perf + RGPD).
   ========================================================================== */

:root {
  /* Marine — valeurs relevées sur le monogramme d'origine */
  --navy-900: #0b1632;
  --navy-800: #12233f;
  --navy-700: #1b3560;
  --navy-600: #304476;
  --navy-300: #93a1bd;

  /* Neutres chauds */
  --ink: #16202f;
  --muted: #56606f;
  --line: #ddd9d1;
  --line-soft: #eceae4;
  --line-ui: #8b8579;   /* bordure de contrôle interactif — contraste AA 3:1 */
  --paper: #faf9f6;
  --paper-alt: #f2f0ea;
  --white: #ffffff;

  /* Accent laiton — usage strictement décoratif / typographique */
  --brass: #9a7b4f;
  --brass-ink: #745c35;
  --brass-soft: #f0e8da;

  /* Signal */
  --todo-bg: #fdf3d6;
  --todo-line: #d9b64e;
  --todo-ink: #6b5209;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 1180px;
  --wrap-narrow: 720px;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(11, 22, 50, .05);
}

/* --------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--navy-900);
  line-height: 1.2;
  letter-spacing: -.005em;
  margin: 0 0 .6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 5.2vw, 3.15rem); }
h2 { font-size: clamp(1.55rem, 3.4vw, 2.15rem); }
h3 { font-size: 1.16rem; font-family: var(--sans); font-weight: 650; letter-spacing: -.01em; }
h4 { font-size: 1rem;    font-family: var(--sans); font-weight: 650; }

p { margin: 0 0 1.1em; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

/* Évite qu'un paragraphe se termine par un mot seul sur sa dernière ligne.
   Ignoré par les navigateurs qui ne le connaissent pas : aucun risque. */
p, li, dd, dt, summary, figcaption { text-wrap: pretty; }

/* Un mot composé ne se coupe pas à son trait d'union : « expert-comptable »
   ne doit pas se scinder en « expert- » puis « comptable ». */
.mot { white-space: nowrap; }

a { color: var(--navy-700); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--navy-900); }

:focus-visible {
  outline: 2px solid var(--navy-600);
  outline-offset: 3px;
  border-radius: 2px;
}

img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy-900); color: #fff;
  padding: .7rem 1.1rem; z-index: 200; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2rem); }
.wrap-narrow { max-width: var(--wrap-narrow); }

.eyebrow {
  font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brass-ink);
  margin: 0 0 .9rem;
}
.lede { font-size: 1.1rem; color: var(--muted); }
.small { font-size: .87rem; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- header --- */

.masthead {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 249, 246, .92);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
/* Safari < 15 et navigateurs sans backdrop-filter : fond opaque de repli */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .masthead { background: var(--paper); }
}

/* Les ancres ne doivent pas se caler sous l'en-tête collant. */
section[id], .doc h2[id], .doc h3[id], main[id] { scroll-margin-top: 88px; }
@media (max-width: 420px) { section[id], .doc h2[id], .doc h3[id] { scroll-margin-top: 74px; } }
.masthead__inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 66px;
}
.brand {
  display: flex; align-items: center; gap: .7rem;
  text-decoration: none; color: var(--navy-900); margin-right: auto;
}
.brand svg { width: 21px; color: var(--navy-900); display: block; }
.brand__name {
  font-family: var(--sans); font-weight: 700;
  font-size: .84rem; letter-spacing: .13em; text-transform: uppercase;
  line-height: 1.1;
}
.brand__name span { font-weight: 400; color: var(--navy-600); }

.nav { display: flex; align-items: center; gap: 1.55rem; }
.nav a {
  font-size: .92rem; color: var(--ink); text-decoration: none;
  padding: .3rem 0; border-bottom: 1px solid transparent;
}
.nav a:hover { border-bottom-color: var(--brass); color: var(--navy-900); }
@media (max-width: 860px) { .nav { display: none; } }

.cta-long { display: inline; }
.cta-short { display: none; }
@media (max-width: 420px) {
  .cta-long { display: none; }
  .cta-short { display: inline; }
  .masthead__inner { min-height: 58px; }
  .brand__name { font-size: .78rem; }
}

/* -------------------------------------------------------------- hero --- */

.hero { border-bottom: 1px solid var(--line-soft); background: var(--white); }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(200px, 300px) 1fr;
  align-items: stretch;
  gap: clamp(1.8rem, 5vw, 4.5rem);
}
.hero__mark {
  position: relative; overflow: hidden;
  background: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
  min-height: 260px;
}
/* rappel du pli de papier du visuel d'origine */
.hero__mark::before,
.hero__mark::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
.hero__mark::before {
  background: var(--navy-700);
  clip-path: polygon(0 0, 100% 0, 0 78%);
  opacity: .55;
}
.hero__mark::after {
  background: var(--navy-600);
  clip-path: polygon(0 100%, 62% 100%, 0 46%);
  opacity: .32;
}
.hero__mark svg { position: relative; width: clamp(74px, 12vw, 108px); color: #fff; }

.hero__body {
  padding: clamp(2.6rem, 6vw, 5rem) 0 clamp(2.6rem, 6vw, 4.4rem);
  align-self: center;
}
.hero__body h1 { margin-bottom: .45em; }
.hero__body h1 .sub { display: block; color: var(--navy-600); font-style: italic; }
.hero__tagline {
  font-family: var(--serif); font-size: clamp(1.08rem, 2.1vw, 1.32rem);
  color: var(--navy-800); max-width: 42ch; margin-bottom: 1.6rem;
  text-wrap: balance;
}
.hero__rule { width: 62px; height: 2px; background: var(--brass); margin: 0 0 1.3rem; }
.hero__role { font-size: .94rem; color: var(--muted); margin-bottom: 2rem; max-width: none; text-wrap: pretty; }

@media (max-width: 760px) {
  .hero__grid { grid-template-columns: 1fr; gap: 0; }
  .hero__mark { min-height: 0; padding: 2.2rem 1.5rem; }
  .hero__mark svg { width: 62px; }
  .hero__mark::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
  .hero__mark::after  { clip-path: polygon(100% 100%, 100% 20%, 30% 100%); }
  .hero__body { padding: 2.2rem 0 2.6rem; }
}

/* ------------------------------------------------------------ boutons --- */

.btns { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .78rem 1.5rem;
  font-size: .95rem; font-weight: 600; font-family: var(--sans);
  text-decoration: none; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn--solid { background: var(--navy-900); color: #fff; }
.btn--solid:hover { background: var(--navy-700); color: #fff; }
.btn--ghost { border-color: var(--line-ui); color: var(--navy-900); background: transparent; }
.btn--ghost:hover { border-color: var(--navy-600); background: var(--white); color: var(--navy-900); }
.btn--sm { padding: .55rem 1.05rem; font-size: .87rem; }

/* ----------------------------------------------------------- sections --- */

.section { padding: clamp(3.4rem, 7.5vw, 5.6rem) 0; }
.section--alt { background: var(--paper-alt); border-block: 1px solid var(--line-soft); }
.section--dark { background: var(--navy-900); color: #e8ecf4; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark .eyebrow { color: var(--navy-300); }
.section--dark a { color: #fff; }

.section__head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__head > h2 { max-width: none; }
.section__head > .lede { max-width: 62ch; text-wrap: balance; }

/* --------------------------------------------------- sections en prose --- */
/* Sur grand écran, le titre passe en colonne de gauche et le texte occupe la
   largeur restante. La mesure de ligne reste courte — c'est ce qui rend un
   paragraphe lisible — mais la page cesse d'avoir une colonne vide à droite. */
.editorial__body > p { max-width: 66ch; }

@media (min-width: 1040px) {
  .editorial {
    display: grid;
    grid-template-columns: minmax(230px, 320px) minmax(0, 1fr);
    gap: clamp(3rem, 5vw, 5.5rem);
    align-items: start;
  }
  .editorial .section__head { margin-bottom: 0; }
  .editorial__body > p { max-width: none; }
  .editorial__body.glossary { margin-top: -.6rem; }
}

/* --------------------------------------------------------- méthode --- */

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 0; }
.steps li {
  counter-increment: s;
  display: grid; grid-template-columns: 3.6rem 1fr; gap: 1.4rem;
  padding: 1.75rem 0; border-top: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
  content: counter(s, decimal-leading-zero);
  font-family: var(--serif); font-size: 1.5rem; color: var(--brass);
  line-height: 1.1;
}
.steps h3 { margin-bottom: .35em; }
.steps p { margin: 0; color: var(--muted); }
@media (max-width: 560px) {
  .steps li { grid-template-columns: 1fr; gap: .5rem; }
}
/* Sur grand écran : numéro | intitulé | texte, pour occuper la largeur. */
@media (min-width: 1040px) {
  .steps li { grid-template-columns: 3.6rem minmax(190px, 270px) minmax(0, 1fr); column-gap: 2.6rem; }
  .steps li > div { display: contents; }
  .steps h3 { margin-bottom: 0; }
  .steps p { max-width: none; }
}

/* ----------------------------------------------------------- cartes --- */

.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
/* Six cartes : 3x2, puis 2x3, puis 1x6. La grille reste toujours pleine. */
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid--3 { grid-template-columns: 1fr; } }
.card { background: var(--white); padding: 1.7rem 1.6rem; }
.section--alt .card { background: var(--paper); }
.card h3 { margin-bottom: .45em; text-wrap: normal; }
.card p { color: var(--muted); font-size: .95rem; margin: 0; }
.section-note {
  font-size: .87rem; color: var(--muted); margin-top: 1.6rem; max-width: none;
}
@media (min-width: 901px) { .section-note { max-width: 66.7%; } }

.card__tag {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brass-ink); margin-bottom: .7rem;
}

/* ------------------------------------------------------ transparence --- */

.panel {
  background: var(--white); border: 1px solid var(--line);
  border-left: 3px solid var(--navy-700);
  padding: clamp(1.5rem, 3.5vw, 2.4rem);
}
.section--alt .panel { background: var(--paper); }
.panel + .panel { margin-top: 1.1rem; }
.panel h3 { margin-bottom: .55em; }

/* Même logique que les étapes : l'intitulé à gauche, le propos à droite. */
@media (min-width: 1040px) {
  .panel {
    display: grid;
    grid-template-columns: minmax(215px, 300px) minmax(0, 1fr);
    column-gap: 2.6rem;
  }
  .panel > h3 { grid-column: 1; grid-row: 1 / span 99; align-self: start; margin: 0; }
  .panel > :not(h3) { grid-column: 2; }
  .panel p { max-width: none; }
}

.facts { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: .85rem; }
/* En grille, tout élément inline du <li> deviendrait une cellule séparée et
   sauterait à la ligne suivante. On reste donc en bloc, puce en absolu. */
.facts li { position: relative; padding-left: 2.05rem; font-size: .96rem; }
.facts li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 8px; height: 8px;
  background: var(--brass); transform: rotate(45deg);
}

/* --------------------------------------------------------- glossaire --- */

.glossary { border-top: 1px solid var(--line); }
.glossary details { border-bottom: 1px solid var(--line); }
/* En flex, le texte forme un élément qui refuse de descendre sous la largeur
   de son plus long mot insécable : à 320 px, « Défiscalisation » débordait.
   En bloc avec le signe en position absolue, le texte se replie normalement. */
.glossary summary {
  cursor: pointer; padding: 1.05rem 2.2rem 1.05rem 0; list-style: none;
  font-weight: 600; font-size: 1rem; color: var(--navy-900);
  position: relative;
}
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary::after {
  content: "+"; font-family: var(--serif); font-size: 1.35rem;
  color: var(--brass); line-height: 1;
  position: absolute; right: 0; top: 1rem;
}
.glossary details[open] summary::after { content: "\2013"; }
.glossary summary:hover { color: var(--navy-600); }
.glossary .answer { padding: 0 0 1.3rem; color: var(--muted); font-size: .96rem; max-width: 72ch; }
.glossary .answer p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------- contact --- */

.contact-grid {
  display: grid; grid-template-columns: 1fr auto; gap: clamp(1.6rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; gap: 2.6rem; }
}

.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.contact-list a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.3); }
.contact-list a:hover { border-bottom-color: #fff; }
.contact-list li { display: flex; align-items: center; gap: .8rem; }
.contact-list svg { width: 17px; height: 17px; color: var(--navy-300); flex: none; }

.section--dark .btn--solid { background: #fff; color: var(--navy-900); }
.section--dark .btn--solid:hover { background: var(--paper-alt); color: var(--navy-900); }
.section--dark .btn--ghost { border-color: rgba(255,255,255,.35); color: #fff; }
.section--dark .btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,.07); color: #fff; }

/* ------------------------------------------------ avertissement risque --- */

.risk {
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
  padding: clamp(2rem, 4vw, 2.8rem) 0;
}
.risk h2 { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--navy-800); margin-bottom: 1rem; }
.risk p { font-size: .85rem; color: var(--muted); max-width: 78ch; margin-bottom: .9rem; line-height: 1.6; }

/* Un avertissement réglementaire long se lit mieux en deux colonnes qu'en
   lignes de 1 100 px — et la largeur disponible est enfin occupée. */
/* Les deux blocs réglementaires se calent sur la même grille que le pied de
   page : leurs gouttières coïncident au pixel près, au lieu de tomber 14 px
   à côté — ce qui se voyait plus qu'une absence totale d'alignement. */
@media (min-width: 900px) {
  .risk__body, .footer__statut {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 2.2rem;
    align-items: start;
  }
  .risk__body > p, .footer__statut > p { grid-column: span 2; max-width: none; margin-bottom: 0; }
}

/* ------------------------------------------------------------ footer --- */

.footer { background: var(--navy-900); color: #b9c3d6; padding: clamp(2.8rem, 5vw, 3.8rem) 0 2rem; font-size: .88rem; }
.footer a { color: #dfe5f0; }
.footer a:hover { color: #fff; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 2.2rem; }
.footer h3 { color: #fff; font-size: .74rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; margin-bottom: 1rem; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.footer__brand svg { width: 26px; color: #fff; margin-bottom: .9rem; display: block; }
.footer__legal {
  margin-top: 2.6rem; padding-top: 1.6rem; border-top: 1px solid rgba(255,255,255,.13);
  display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between;
  font-size: .8rem; color: #93a1bd;
}
.footer__statut { font-size: .8rem; color: #93a1bd; line-height: 1.55; margin-top: 1.8rem; }
.footer__statut > p { max-width: 78ch; margin-bottom: 1.1rem; }
.footer__statut > p:last-child { margin-bottom: 0; }

/* -------------------------------------------------- pages éditoriales --- */

.page-head { background: var(--navy-900); color: #fff; padding: clamp(2.6rem, 6vw, 4.2rem) 0 clamp(2.2rem, 5vw, 3.4rem); }
.page-head h1 { color: #fff; margin-bottom: .3em; }
.page-head p { color: var(--navy-300); margin: 0; }
.page-head .eyebrow { color: var(--navy-300); }

.doc { padding: clamp(2.6rem, 6vw, 4.2rem) 0 clamp(3rem, 7vw, 5rem); }
.doc h2 {
  font-size: 1.32rem; font-family: var(--sans); font-weight: 650;
  margin-top: 2.8rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.doc h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.doc h3 { margin-top: 1.9rem; font-size: 1.02rem; }
.doc p, .doc li { font-size: .96rem; }
.doc ul, .doc ol { padding-left: 1.15rem; margin: 0 0 1.1em; }
.doc li { margin-bottom: .45em; }
.doc dl { margin: 0 0 1.2em; display: grid; grid-template-columns: minmax(160px, 15rem) 1fr; gap: .55rem 1.4rem; font-size: .95rem; }
.doc dt { color: var(--muted); }
.doc dd { margin: 0; }
@media (max-width: 620px) {
  .doc dl { grid-template-columns: 1fr; gap: .1rem 0; }
  .doc dd { margin-bottom: .8rem; }
}
.toc { background: var(--paper-alt); border: 1px solid var(--line); padding: 1.3rem 1.5rem; margin-bottom: 2.8rem; }
.toc h2 { font-size: .74rem !important; letter-spacing: .13em; text-transform: uppercase; margin: 0 0 .8rem !important; padding: 0 !important; border: 0 !important; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.1rem; columns: 2; column-gap: 2rem; }
.toc li { font-size: .9rem; break-inside: avoid; }
@media (max-width: 620px) { .toc ol { columns: 1; } }

/* --------------------------------------------------- marqueurs à faire --- */

.todo {
  background: var(--todo-bg); border-bottom: 1px dashed var(--todo-line);
  color: var(--todo-ink); font-weight: 600; padding: .05em .35em;
  font-family: var(--sans); font-size: .93em;
}
.todo-note {
  background: var(--todo-bg); border: 1px solid var(--todo-line);
  color: var(--todo-ink); padding: 1rem 1.25rem; font-size: .87rem;
  margin-bottom: 2.4rem; border-radius: var(--radius);
}
.todo-note strong { display: block; margin-bottom: .35rem; }
.todo-note p { margin: 0; color: inherit; }

/* ------------------------------------------------- écrans tactiles --- */
/* Cibles de touche d'au moins ~44 px sur mobile et tablette. */
@media (pointer: coarse) {
  .footer ul { gap: .95rem; }
  .footer ul a, .footer__legal a { display: inline-block; padding-block: .35rem; }
  .contact-list { gap: 1.1rem; }
  .contact-list a { display: inline-block; padding-block: .45rem; }
  .toc li { margin-bottom: .45rem; }
  .toc a { display: inline-block; padding-block: .25rem; }
  .glossary summary { padding: 1.15rem 0; }
  .btn { padding-block: .95rem; }
  .btn--sm { padding-block: .7rem; }
}

/* ---------------------------------------------------------- impression --- */

@media print {
  .masthead, .hero__mark, .btns, .footer__grid { display: none; }
  body { background: #fff; font-size: 11pt; }
  .section--dark, .page-head, .footer { background: #fff !important; color: #000 !important; }
  .page-head h1, .footer h3 { color: #000 !important; }
  a { color: #000; }
}
