/* Mesuraclic · finition éditoriale des pages intérieures · T-259 */
:root {
  --m-measure: 76rem;
  --m-reading: 68ch;
  --m-quiet: #6d5a74;
  --m-rule: #cbbdce;
  --m-rose-paper: #f0eaf2;
  --m-focus: #593469;
}

main:not(.m-home) { max-width: var(--m-measure); }
main:not(.m-home) > .breadcrumb { margin-inline: clamp(1.25rem, 4vw, 3.5rem); }
main:not(.m-home) > .intro {
  max-width: 74rem;
  padding: clamp(3.25rem, 7vw, 6.25rem) clamp(1.25rem, 5vw, 4rem) clamp(2.25rem, 4.5vw, 3.75rem);
  position: relative;
}
main:not(.m-home) > .intro::after {
  content: "";
  display: block;
  width: min(8rem, 25vw);
  height: 4px;
  margin-top: clamp(2rem, 4vw, 3rem);
  background: var(--m-lime);
}
main:not(.m-home) > .intro h1 {
  max-width: 17ch;
  font-size: clamp(2.75rem, 6.6vw, 5.35rem);
  line-height: .98;
  letter-spacing: -.055em;
  margin-block: 1.35rem 1.5rem;
}
main:not(.m-home) > .intro .lead { max-width: 59ch; font-size: clamp(1.05rem, 1.6vw, 1.22rem); line-height: 1.72; }
main:not(.m-home) > .intro .meta { max-width: 78ch; border-top: 1px solid var(--m-rule); padding-top: 1rem; margin-top: 1.5rem; line-height: 1.65; }

/* Chapitrage généré depuis les h2 déjà présents dans les pages. */
.m-chapters {
  display: grid;
  grid-template-columns: minmax(8rem, .72fr) minmax(0, 3fr);
  gap: 1.25rem 2rem;
  align-items: start;
  margin: 0 clamp(1.25rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4rem);
  padding: 1.15rem 0 1.25rem;
  border-top: 1px solid var(--m-rule);
  border-bottom: 1px solid var(--m-rule);
}
.m-chapters > p { margin: .45rem 0 0; color: var(--m-quiet); font-size: .69rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.m-chapters ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; padding: 0; margin: 0; list-style: none; counter-reset: m-chapter; }
.m-chapters li { counter-increment: m-chapter; min-width: 0; }
.m-chapters a { display: inline-flex; align-items: baseline; gap: .45rem; min-height: 44px; max-width: 30ch; padding: .65rem .72rem; border: 1px solid transparent; color: var(--m-ink); font-size: .76rem; line-height: 1.35; text-decoration: none; }
.m-chapters a::before { content: counter(m-chapter, decimal-leading-zero); flex: 0 0 auto; color: var(--m-quiet); font: .65rem/1.4 ui-monospace, monospace; }
.m-chapters a:hover, .m-chapters a:focus-visible { border-color: var(--m-rule); background: var(--m-white); text-decoration: underline; text-underline-offset: .22em; }

/* Les pages de lecture ont un rythme de chapitre plutôt qu'une pile de cartes. */
main:not(.m-home) > .content,
main:not(.m-home) > .price-sheet,
main:not(.m-home) > .sheet,
main:not(.m-home) > .method,
main:not(.m-home) > .feature,
main:not(.m-home) > .homelead {
  margin-inline: clamp(1.25rem, 4vw, 3.5rem);
}
main:not(.m-home) > .content,
main:not(.m-home) > .price-sheet,
main:not(.m-home) > .sheet,
main:not(.m-home) > .method {
  padding: clamp(1.4rem, 4.5vw, 3.4rem);
  border: 1px solid var(--m-rule);
  border-top: 3px solid var(--m-ink);
  margin-bottom: clamp(2rem, 5vw, 3.6rem);
  background: var(--m-white);
}
main:not(.m-home) > .content.prose,
main:not(.m-home) > .price-sheet > p,
main:not(.m-home) > .sheet > p { max-width: 74ch; }
main:not(.m-home) > .content > h2,
main:not(.m-home) > .price-sheet > h2,
main:not(.m-home) > .sheet > h2,
main:not(.m-home) > .method > h2 {
  max-width: 23ch;
  font-size: clamp(1.8rem, 3.7vw, 3.15rem);
  line-height: 1.07;
  margin: .2rem 0 1.35rem;
}
main:not(.m-home) > .content h2 + p,
main:not(.m-home) > .price-sheet h2 + p,
main:not(.m-home) > .sheet h2 + p { margin-top: 0; }
main:not(.m-home) > .content p,
main:not(.m-home) > .content li,
main:not(.m-home) > .price-sheet p,
main:not(.m-home) > .sheet p,
main:not(.m-home) > .method p,
main:not(.m-home) > .method li { line-height: 1.78; }
main:not(.m-home) > .content p + p,
main:not(.m-home) > .price-sheet p + p,
main:not(.m-home) > .sheet p + p { margin-top: 1.15rem; }
main:not(.m-home) > .content h2:not(:first-child) { border-top: 1px solid var(--m-rule); padding-top: 1.65rem; margin-top: 2.15rem; }
main:not(.m-home) > .content h3,
main:not(.m-home) > .price-sheet h3,
main:not(.m-home) > .sheet h3 { line-height: 1.3; }
main:not(.m-home) > .content ul,
main:not(.m-home) > .content ol,
main:not(.m-home) > .price-sheet ol,
main:not(.m-home) > .sheet ol { padding-left: 1.25rem; }
main:not(.m-home) > .content li,
main:not(.m-home) > .price-sheet li,
main:not(.m-home) > .sheet li { padding-left: .25rem; margin-block: .45rem; }
main:not(.m-home) .source { max-width: 76ch; padding-top: .8rem; border-top: 1px solid var(--m-rule); font-size: .76rem; line-height: 1.65; overflow-wrap: anywhere; }

/* Décomposer les formulaires et rendre la sortie plus facile à relire. */
.workspace { gap: clamp(1.25rem, 3.5vw, 2.5rem); margin: 0 clamp(1.25rem, 4vw, 3.5rem) clamp(3rem, 6vw, 5rem); }
.workspace form { padding: clamp(1.25rem, 3.2vw, 2.35rem); border: 1px solid var(--m-rule); border-top: 4px solid var(--m-ink); }
.workspace .formtop { gap: 1.25rem; align-items: center; padding-bottom: 1.1rem; border-bottom: 1px solid var(--m-rule); margin-bottom: 1.25rem; }
.workspace .formtop h2 { max-width: 18ch; font-size: clamp(1.7rem, 3vw, 2.25rem); }
.workspace fieldset > h3,
.workspace fieldset > section > h3 { margin: 2rem 0 .45rem; padding-top: 1.2rem; border-top: 1px solid var(--m-rule); font-size: .83rem; letter-spacing: .045em; }
.workspace .hint { max-width: 69ch; color: var(--m-quiet); line-height: 1.62; }
.workspace label { font-size: .86rem; line-height: 1.5; margin: 1rem 0; }
.workspace label small { display: block; margin-top: .35rem; line-height: 1.55; }
.workspace input:not([type=checkbox]), .workspace select, .workspace textarea { min-height: 48px; padding: .78rem .85rem; font-size: 1rem; border-radius: 0; }
.workspace .check { align-items: flex-start; gap: .75rem; padding: .55rem 0; min-height: 44px; }
.workspace .check input { width: 20px; height: 20px; flex: 0 0 auto; margin: .12rem 0 0; }
.workspace .result { padding: clamp(1.3rem, 3.2vw, 2.35rem); border: 1px solid #b3bf69; border-top: 4px solid var(--m-ink); box-shadow: 8px 8px 0 var(--m-rose-paper); }
.workspace .result > .eyebrow { margin-top: 0; }
.workspace .result > h2 { max-width: 17ch; margin-top: .7rem; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.workspace .result #status { padding: .8rem 0; border-bottom: 1px solid #b3bf69; line-height: 1.6; }
.workspace .result .main-result { padding-block: 1.35rem; }
.workspace .result .main-result strong { display: block; line-height: 1.05; padding-block: .25rem .45rem; font-variant-numeric: tabular-nums; }
.workspace .result dl { margin-top: .5rem; }
.workspace .result dl div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7ch, .75fr); align-items: baseline; gap: 1.2rem; padding: .8rem 0; }
.workspace .result dt { min-width: 0; max-width: none; line-height: 1.5; }
.workspace .result dd { min-width: 0; max-width: none; margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workspace .result.stale, .workspace .result[data-state="stale"] { border-top-style: dashed; }
.workspace .result.stale #status, .workspace .result[data-state="stale"] #status { font-weight: 600; }
.workspace .result textarea { display: block; width: 100%; max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.errorbox { padding: 1rem 1.1rem; border-left: 4px solid #8b3d38; background: #f7ecea; }
.errorbox h3 { margin: 0 0 .4rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #8b3d38 !important; outline: 2px solid #8b3d38; outline-offset: 1px; }

/* Tableaux lisibles en largeur et parcourables au clavier sur petit écran. */
.tablewrap { position: relative; max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; border: 1px solid var(--m-rule); background: var(--m-white); scrollbar-color: var(--m-purple) var(--m-rose-paper); }
.tablewrap:focus-visible { outline: 3px solid var(--m-focus); outline-offset: 4px; }
.tablewrap table { margin: 0; }
.tablewrap[data-wide-table="true"] table { min-width: 760px; }
.tablewrap[data-wide-table="true"] thead th { position: sticky; top: 0; z-index: 1; }
.tablewrap[data-wide-table="true"] tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--m-white); box-shadow: 1px 0 var(--m-rule); }
.tablewrap[data-wide-table="true"] thead th:first-child { left: 0; z-index: 2; }
.tablewrap table caption { padding: 1rem 1rem .7rem; color: var(--m-quiet); font-size: .72rem; font-weight: 400; line-height: 1.5; }
.tablewrap th, .tablewrap td { padding: .85rem .9rem; line-height: 1.55; }
.tablewrap thead th { color: var(--m-ink); background: #eee7f0; border-bottom: 2px solid var(--m-ink); font-size: .72rem; }
.tablewrap tbody tr:nth-child(even) { background: #fbf9fb; }
.tablewrap td { font-variant-numeric: tabular-nums; }
.m-table-help { display: none; }

/* Les pages de fondation gardent une colonne de lecture et une navigation calme. */
main:not(.m-home) .method { background: transparent; }
main:not(.m-home) .methodgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(1.5rem, 5vw, 4rem); }
main:not(.m-home) .methodgrid article { padding: 1.3rem 0 1rem; border-top: 1px solid var(--m-rule); }
main:not(.m-home) .methodgrid article h3 { max-width: 28ch; font: 600 1.25rem/1.2 MesuraSerif, Georgia, serif; }
main:not(.m-home) .breadcrumb a { min-height: 36px; display: inline-flex; align-items: center; }
main:not(.m-home) a:not(.m-brand):not(.m-btn) { text-decoration-thickness: 1px; text-underline-offset: .22em; }

@media (max-width: 760px) {
  .m-chapters { grid-template-columns: 1fr; gap: .4rem; }
  .m-chapters > p { margin: 0; }
  .m-chapters ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem .45rem; }
  .m-chapters a { max-width: none; width: 100%; padding-inline: .4rem; font-size: .72rem; }
  main:not(.m-home) .methodgrid { grid-template-columns: 1fr; }
  .m-table-help { display: block; margin: .45rem 0 .7rem; color: var(--m-quiet); font-size: .72rem; line-height: 1.5; }
  .workspace .result { position: static; }
}
@media (max-width: 420px) {
  main:not(.m-home) > .intro { padding-inline: 1.25rem; }
  main:not(.m-home) > .intro h1 { font-size: clamp(2.55rem, 12vw, 3.15rem); }
  .m-chapters { margin-inline: 1.25rem; }
  .m-chapters ol { grid-template-columns: 1fr; }
  main:not(.m-home) > .content,
  main:not(.m-home) > .price-sheet,
  main:not(.m-home) > .sheet,
  main:not(.m-home) > .method { margin-inline: 1.25rem; padding: 1.3rem 1.15rem; }
  .workspace { margin-inline: 1.25rem; }
  .workspace .formtop { align-items: stretch; flex-direction: column; }
  .workspace .result { box-shadow: 4px 4px 0 var(--m-rose-paper); }
  .tablewrap th, .tablewrap td { padding: .72rem .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .m-chapters a, .tablewrap { scroll-behavior: auto; }
}
@media print {
  .m-chapters, .m-table-help { display: none !important; }
  .tablewrap { overflow: visible; border: 0; }
  .tablewrap[data-wide-table="true"] table { min-width: 0; font-size: 8pt; }
  .tablewrap th, .tablewrap td { position: static !important; padding: .35rem; }
}
