/* WebRepère · parcours intérieurs et outils, v20261023a. Les couches prolongent « le site en coupe ». */

/* Les pages longues se lisent comme un dossier à chapitres, avec repère de position. */
.reading-body {
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: clamp(34px, 6vw, 86px);
}

.reading-aside {
  border-top: 1px solid var(--ink);
  padding-top: 15px;
}

.reading-aside .micro {
  margin-bottom: 17px;
  color: var(--soft);
}

.reading-aside nav {
  gap: 0;
  border-left: 1px solid var(--line);
}

.reading-aside nav a {
  display: block;
  min-height: 44px;
  padding: 11px 10px 11px 13px;
  border-left: 2px solid transparent;
  margin-left: -2px;
  color: var(--soft);
  line-height: 1.45;
  transition: color .2s, border-color .2s;
}

.reading-aside nav a:hover,
.reading-aside nav a[aria-current="location"] {
  color: var(--ink);
  border-left-color: var(--ink);
}

.reading-aside nav a[aria-current="location"] {
  font-weight: 600;
}

.reading-body > article {
  min-width: 0;
  max-width: 78ch;
  counter-reset: chapter;
}

.article-section {
  position: relative;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.article-section::before {
  counter-increment: chapter;
  content: "CHAPITRE 0" counter(chapter);
  display: block;
  margin-bottom: 14px;
  color: var(--soft);
  font: 600 10px/1.3 var(--sans);
  letter-spacing: .13em;
}

.article-section:target {
  scroll-margin-top: 124px;
}

.article-section:target h2 {
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 5px;
  text-underline-offset: 7px;
}

.socle-article > .article-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.socle-article > .article-section:first-child::before {
  content: "LECTURE · 01";
}

.socle-article .article-section > p,
.socle-article .article-section > ul {
  max-width: 72ch;
}

.socle-article .article-section > ul {
  padding-left: 1.2em;
  color: var(--soft);
  line-height: 1.75;
}

.socle-article .article-section > ul li + li {
  margin-top: 9px;
}

.resource-list {
  counter-reset: resource;
}

.resource-list li {
  position: relative;
  padding: 27px 0 30px 76px;
  border-top: 1px solid var(--ink);
  transition: padding-left .28s ease;
}

.resource-list li::before {
  position: absolute;
  left: 0;
  top: 28px;
  color: var(--soft);
  font: 600 12px/1.4 var(--mono, var(--sans));
  font-variant-numeric: tabular-nums;
}

.resource-list li:nth-child(1)::before { content: "01"; }
.resource-list li:nth-child(2)::before { content: "02"; }
.resource-list li:nth-child(3)::before { content: "03"; }
.resource-list li:nth-child(4)::before { content: "04"; }
.resource-list li:nth-child(5)::before { content: "05"; }
.resource-list li:hover { padding-left: 84px; }
.resource-list li:last-child { border-bottom: 1px solid var(--ink); }

.resource-list .resource-no {
  margin-bottom: 9px;
  color: var(--soft);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.resource-list h2 {
  max-width: 23ch;
  margin-bottom: 10px;
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.04em;
}

.resource-list h2 a { text-decoration-thickness: 1px; }
.resource-list > li > p:last-child { max-width: 58ch; color: var(--soft); }

/* Les outils montrent d'abord leur résultat, puis gardent la saisie à portée. */
body[data-page="budget"] .budget-layout,
body[data-page="mesures"] .budget-layout {
  align-items: start;
  gap: clamp(34px, 5vw, 76px);
}

.cost-form {
  min-width: 0;
  padding-right: clamp(0px, 2vw, 25px);
}

.cost-form fieldset {
  position: relative;
  padding-top: 25px;
  padding-bottom: 33px;
}

.cost-form legend {
  padding: 0 10px 0 0;
  background: var(--paper);
  font-weight: 600;
}

.cost-form legend::first-letter { color: var(--soft); }

.field > span:first-child {
  color: var(--ink);
  line-height: 1.45;
}

.input-wrap,
.field select {
  min-height: 48px;
  border: 1px solid var(--line);
  border-bottom-color: var(--ink);
  border-radius: 0;
  transition: border-color .16s, background-color .16s;
}

.input-wrap:focus-within,
.field select:focus-visible {
  border-color: var(--ink);
  background: var(--white);
}

.input-wrap input {
  min-height: 46px;
  font-size: 18px;
}

.results {
  min-width: 0;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  background: var(--white);
}

.results .result-heading {
  padding-top: 0;
  border-top: 0;
}

.results .result-heading h2 { font-size: 16px; }
.results .cash-total { padding-block: 23px 30px; }
.results .annual-chart { min-height: 190px; }
.results .result-details > div { padding-block: 13px; }
.results .result-details dt { max-width: 62%; }

.stale {
  border-left: 3px solid #927000;
  background: #fbf4d3;
  line-height: 1.5;
}

.error,
.form-error {
  border-left: 3px solid var(--error);
  background: #f8e8e0;
  color: var(--error);
}

.cost-form input[aria-invalid="true"],
.cost-form select[aria-invalid="true"],
.choice-form input[aria-invalid="true"],
.choice-form select[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: inset 3px 0 0 var(--error);
}

.plain-button {
  min-height: 44px;
  padding: 9px 4px;
  color: var(--ink);
  cursor: pointer;
}

.choice-form {
  border: 0;
  border-block: 1px solid var(--ink);
  padding: 28px 0 30px;
  background: transparent;
}

.choice-form .field-grid {
  gap: 25px 28px;
}

.choice-form label {
  line-height: 1.5;
}

.choice-form label small {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  line-height: 1.5;
}

.choice-form select,
.choice-form input {
  min-height: 48px;
  border-radius: 0;
}

/* Les contrôles restent lisibles et ne déclenchent pas de zoom tactile. */
.cost-form input,
.cost-form select,
.choice-form input,
.choice-form select {
  font-size: 16px;
}

.choice-results {
  border-bottom: 1px solid var(--ink);
}

.family-option {
  grid-template-columns: 52px minmax(0, 1fr);
  padding-block: 25px;
}

.family-option > span {
  color: var(--soft);
  font: 600 11px/1.5 var(--mono, var(--sans));
  font-variant-numeric: tabular-nums;
}

.family-option h3 { font-size: 26px; line-height: 1.12; }
.family-option p { max-width: 62ch; line-height: 1.65; }
.family-option p + p { border-left: 2px solid var(--lime); padding-left: 12px; }
.choice-message { padding: 14px 0 20px; line-height: 1.55; }

/* Le tableau garde sa hiérarchie au clavier et devient une lecture par critère. */
.hosting-scroll:focus-visible,
.comparison:focus-visible {
  outline-color: var(--focus);
}

.comparison caption {
  padding: 0 0 14px;
  color: var(--soft);
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
}

.comparison tbody tr:nth-child(even) { background: rgb(217 230 215 / .32); }
.comparison tbody th[scope="row"] { font-weight: 600; }
.comparison td { line-height: 1.65; }

.measure-list li {
  border-radius: 0;
  border-width: 0 0 0 3px;
  border-color: var(--line);
  padding: 18px 18px 20px;
  background: transparent;
}

.measure-list li:first-child { border-left-color: var(--ink); }
.measure-head b { font-size: clamp(27px, 3vw, 36px); letter-spacing: -.05em; }
.measure-meta { line-height: 1.6; }
.measure-cmp { border-top-style: solid; border-color: var(--line); line-height: 1.5; }
.empty { padding: 22px 0; border-block: 1px solid var(--line); line-height: 1.65; }

@media (min-width: 761px) {
  body[data-page="budget"] .results,
  body[data-page="mesures"] .results { top: 112px; }

  body[data-page="budget"] .results { position: sticky; }
  body[data-page="mesures"] .results { position: sticky; }
}

@media (max-width: 760px) {
  .reading-body {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }
  .reading-body > *,
  .reading-body > article,
  .reading-hero,
  .reading-intro,
  .resource-list,
  .resource-list li {
    min-width: 0;
  }
  .reading-hero h1,
  .resource-list h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .reading-aside { border-top: 1px solid var(--line); }
  .reading-aside nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 4px;
    padding-bottom: 7px;
    border-left: 0;
    scrollbar-width: thin;
  }
  .reading-aside nav a {
    flex: 0 0 auto;
    min-height: 44px;
    max-width: 18rem;
    padding: 10px 12px;
    border: 1px solid var(--line);
    white-space: normal;
  }
  .reading-aside nav a[aria-current="location"] {
    border-color: var(--ink);
    background: var(--lime);
  }
  .article-section { padding-top: 20px; }
  .resource-list li { padding-left: 48px; }
  .resource-list li:hover { padding-left: 48px; }
  .resource-list li::before { top: 29px; }
  .results { padding: 20px 18px; }
  .cost-form { padding-right: 0; }
  .cost-form fieldset { padding-top: 23px; }
  .choice-form { padding-block: 22px; }
  .family-option { grid-template-columns: 40px minmax(0, 1fr); }
}

@media (max-width: 390px) {
  .results { padding-inline: 14px; }
  .annual-chart { gap: 6px; }
  .annual-year .bar { padding-inline: 4px; }
  .annual-year strong { font-size: 15px; letter-spacing: -.03em; }
  .annual-year span { font-size: 10px; }
  .result-details > div { gap: 10px; }
  .result-details dd { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .reading-aside nav a,
  .resource-list li,
  .input-wrap,
  .field select { transition: none; }
}

@media (min-width: 761px) and (prefers-reduced-motion: reduce) {
  .resource-list li:hover { padding-left: 76px; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .resource-list li:hover { padding-left: 48px; }
}

@media (max-width: 360px) {
  .cost-form .field-grid { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .reading-aside,
  .site-header,
  .site-footer,
  .plain-button,
  .btn { display: none !important; }
  .reading-body { display: block; }
  .socle-article { max-width: none; }
  .article-section { break-inside: avoid; }
}

/* Le menu reste lisible au-dessus des champs pendant le défilement. */
.site-header { background: var(--paper); }
.shell > .article-section::before { content: none; }
