/* Isolated public pages on the LE LABO IA design system: /systeme/, /financement/, /merci-rdv/
   and the 404. Shared form pieces are mdy-isolated-*, page compositions mdy-<page>-*.
   Rules: tokens only (--labo-*, --mdy-*), labo9-* classes composed and never restyled,
   states carried by attributes. Forms, fields and measurement hooks keep their own sources. */

/* 1. Page --------------------------------------------------------------------------------------- */
/* Panels, steps and branches are toggled with the hidden attribute by their scripts. */
.mdy-isolated-page [hidden] { display: none !important; }
.mdy-isolated-page main [id] { scroll-margin-top: calc(var(--mdy-header-height) + var(--labo-space-4)); }
.mdy-isolated-center { text-align: center; }
.mdy-isolated-center .labo9-band-header { justify-items: center; margin-inline: auto; }
.mdy-isolated-actions-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--labo-space-3); }

/* 2. Systeme ------------------------------------------------------------------------------------ */
.mdy-systeme-demo {
  position: relative;
  display: grid;
  gap: var(--labo-space-3);
  padding: var(--labo-space-6) var(--labo-space-5) var(--labo-space-5);
  border: var(--labo-border-width-hairline) solid var(--labo-border-strong);
  border-radius: var(--labo-radius-lg);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--labo-glow-start) 16%, transparent), transparent 60%),
    var(--labo-surface);
  box-shadow: var(--labo-shadow-dialog);
}
.mdy-systeme-demo::before {
  content: "EXEMPLE ILLUSTRATIF";
  color: var(--labo-text-muted);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-caption);
  letter-spacing: var(--labo-letter-spacing-label);
}
.mdy-systeme-demo__step {
  --mdy-step-tone: var(--labo-glow-blue);
  display: grid;
  grid-template-columns: var(--labo-control-md) minmax(0, 1fr);
  gap: var(--labo-space-3);
  align-items: center;
  min-height: 64px;
  padding: var(--labo-space-3) var(--labo-space-4);
  border: var(--labo-border-width-hairline) solid var(--labo-border);
  border-radius: var(--labo-radius-md);
  background: var(--labo-canvas);
  color: var(--labo-text);
  font-family: var(--labo-font-display);
  font-size: var(--labo-font-size-lead);
  font-weight: var(--labo-font-weight-bold);
}
.mdy-systeme-demo__step:nth-of-type(2) { --mdy-step-tone: var(--labo-glow-lavender); }
.mdy-systeme-demo__step:nth-of-type(3) { --mdy-step-tone: var(--labo-glow-teal); }
.mdy-systeme-demo__step span {
  display: grid;
  place-items: center;
  width: var(--labo-control-md);
  height: var(--labo-control-md);
  border-radius: var(--labo-radius-pill);
  background: color-mix(in srgb, var(--mdy-step-tone) 14%, transparent);
  box-shadow: 0 0 var(--labo-space-5) color-mix(in srgb, var(--mdy-step-tone) 22%, transparent);
  color: var(--mdy-step-tone);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-small);
  font-weight: var(--labo-font-weight-medium);
}
.mdy-systeme-demo__connector {
  width: var(--labo-border-width-strong);
  height: var(--labo-space-4);
  margin-block: calc(-1 * var(--labo-space-2));
  margin-inline-start: calc(var(--labo-space-4) + var(--labo-control-md) / 2 - 1px);
  background: linear-gradient(var(--labo-glow-start), var(--labo-glow-end));
}
.mdy-systeme-phase {
  margin: 0;
  color: var(--labo-text-muted);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-caption);
  letter-spacing: var(--labo-letter-spacing-label);
  text-transform: uppercase;
}
.mdy-systeme-cards > li { display: grid; }
.mdy-systeme-number {
  color: var(--labo-glow-start);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-title-3);
}

/* 3. Shared form card: /systeme/ qualification and /financement/ request ------------------------ */
.mdy-isolated-form {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  padding: clamp(var(--labo-space-5), 4vw, var(--labo-space-7));
  border: var(--labo-border-width-hairline) solid var(--labo-border-strong);
  border-radius: var(--labo-radius-lg);
  background: var(--labo-surface);
  box-shadow: var(--labo-shadow-dialog);
}
.mdy-isolated-form > form { display: grid; gap: var(--labo-space-5); min-width: 0; }

/* Progress of the systeme wizard, rendered by qualification-form.js. */
.mdy-isolated-progress { display: grid; gap: var(--labo-space-3); }
.mdy-isolated-progress__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--labo-space-2);
  margin: 0;
  color: var(--labo-text-muted);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-caption);
  letter-spacing: var(--labo-letter-spacing-label);
  text-transform: uppercase;
}
.mdy-isolated-progress__bar {
  overflow: hidden;
  height: 6px;
  border-radius: var(--labo-radius-pill);
  background: var(--labo-hover);
}
.mdy-isolated-progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--labo-glow-start), var(--labo-glow-end));
  transition: width var(--labo-motion-base) var(--labo-easing-standard);
}
.mdy-isolated-progress-steps {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--labo-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-caption);
  text-align: center;
}
.mdy-isolated-progress-steps li[data-complete] { color: var(--labo-text); }
.mdy-isolated-progress-steps li[aria-current="step"] { color: var(--labo-glow-start); font-weight: var(--labo-font-weight-semibold); }
@media (max-width: 700px) {
  .mdy-isolated-progress-steps { display: none; }
}

/* Steps, fields and choices. */
.mdy-isolated-step { display: grid; gap: var(--labo-space-4); min-width: 0; margin: 0; padding: 0; border: 0; }
.mdy-isolated-step__layout, .mdy-isolated-step__content { display: grid; gap: var(--labo-space-4); min-width: 0; }
.mdy-isolated-step__copy { display: grid; gap: var(--labo-space-2); }
.mdy-isolated-step__title,
.mdy-isolated-step > legend:not(.labo9-visually-hidden) {
  margin: 0;
  padding: 0;
  font-family: var(--labo-font-display);
  font-size: clamp(var(--labo-font-size-heading), 3vw, var(--labo-font-size-title-2));
  font-weight: var(--labo-font-weight-bold);
  line-height: var(--labo-line-height-snug);
  letter-spacing: var(--labo-letter-spacing-title);
  text-wrap: balance;
}
.mdy-isolated-step > legend:not(.labo9-visually-hidden) { float: left; width: 100%; }
.mdy-isolated-step__intro { margin: calc(-1 * var(--labo-space-2)) 0 0; color: var(--labo-text-muted); }
.mdy-isolated-step__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--labo-space-4); align-items: end; }
.mdy-isolated-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--labo-space-4); }
.mdy-isolated-field { min-width: 0; align-content: start; }
.mdy-isolated-optional { color: var(--labo-text-muted); font-weight: var(--labo-font-weight-regular); }

.mdy-isolated-choices { display: grid; gap: var(--labo-space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.mdy-isolated-choices > legend { margin: 0 0 var(--labo-space-1); padding: 0; font-weight: var(--labo-font-weight-semibold); }
.mdy-isolated-choice-list { display: grid; gap: var(--labo-space-2); margin: 0; padding: 0; list-style: none; }
.mdy-isolated-choice-list--inline { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.mdy-isolated-choice {
  display: flex;
  align-items: center;
  gap: var(--labo-space-3);
  min-height: var(--labo-target-min);
  padding: var(--labo-space-3) var(--labo-space-4);
  border: var(--labo-border-width-hairline) solid var(--labo-border-strong);
  border-radius: var(--labo-radius-md);
  background: var(--labo-canvas);
  color: var(--labo-text);
  cursor: pointer;
  transition: border-color var(--labo-motion-fast), background var(--labo-motion-fast);
}
.mdy-isolated-choice:hover { border-color: var(--labo-text-muted); }
.mdy-isolated-choice:has(input:checked) {
  border-color: var(--labo-focus);
  background: color-mix(in srgb, var(--labo-focus) 10%, var(--labo-canvas));
}
.mdy-isolated-choice > span { display: grid; gap: var(--labo-space-1); font-weight: var(--labo-font-weight-semibold); }
.mdy-isolated-choice small { color: var(--labo-text-muted); font-size: var(--labo-font-size-small); font-weight: var(--labo-font-weight-regular); }

.mdy-isolated-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--labo-space-3);
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-small);
  line-height: var(--labo-line-height-reading);
  cursor: pointer;
}
.mdy-isolated-consent .labo9-checkbox { margin-block-start: 2px; }
.mdy-isolated-consent a { color: var(--labo-text); text-decoration: underline; text-underline-offset: 0.2em; }
.mdy-isolated-note a { color: var(--labo-text); text-decoration: underline; text-underline-offset: 0.2em; }
.mdy-isolated-feedback:empty { display: none; }

.mdy-isolated-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--labo-space-3);
  padding-block-start: var(--labo-space-2);
}
.mdy-isolated-actions > :only-child { margin-inline-start: auto; }

/* Result panels and calendar. */
.mdy-isolated-result { display: grid; gap: var(--labo-space-4); outline: none; }
.mdy-isolated-result__route { display: grid; gap: var(--labo-space-4); justify-items: center; text-align: center; }
.mdy-isolated-result__route > h3 {
  margin: 0;
  font-size: clamp(var(--labo-font-size-heading), 4vw, var(--labo-font-size-title-1));
  line-height: var(--labo-line-height-tight);
}
.mdy-isolated-result__route > p { max-width: 60ch; margin: 0; color: var(--labo-text-muted); font-size: var(--labo-font-size-lead); }
.mdy-isolated-calendar {
  justify-self: stretch;
  min-height: 620px;
  overflow: hidden;
  border: var(--labo-border-width-hairline) solid var(--labo-border);
  border-radius: var(--labo-radius-md);
  background: var(--labo-canvas);
}
.mdy-isolated-calendar-fallback {
  display: inline-flex;
  align-items: center;
  min-height: var(--labo-target-min);
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-small);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.mdy-isolated-calendar-fallback:hover { color: var(--labo-text); }

@media (max-width: 700px) {
  .mdy-isolated-grid, .mdy-isolated-step__row { grid-template-columns: minmax(0, 1fr); }
  .mdy-isolated-actions { flex-direction: column-reverse; align-items: stretch; }
  .mdy-isolated-actions .labo9-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .mdy-isolated-progress__fill, .mdy-isolated-choice { transition: none; }
}

/* 4. Financement ---------------------------------------------------------------------------------- */
.mdy-financement-nav {
  position: sticky;
  z-index: var(--labo-layer-sticky);
  top: 0;
  padding-top: var(--labo-safe-area-top);
  border-bottom: var(--labo-border-width-hairline) solid var(--labo-border);
  background: var(--mdy-glass);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
}
.mdy-financement-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--labo-space-5);
  min-height: var(--mdy-header-height);
}
.mdy-financement-nav__links { display: flex; align-items: center; gap: var(--labo-space-1); }
.mdy-financement-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--labo-control-md);
  padding-inline: var(--labo-space-3);
  border-radius: var(--labo-radius-pill);
  color: var(--labo-text-muted);
  font-weight: var(--labo-font-weight-medium);
  text-decoration: none;
}
.mdy-financement-nav__link:hover { background: var(--labo-hover); color: var(--labo-text); }
@media (max-width: 760px) {
  .mdy-financement-nav__link { display: none; }
}

.mdy-financement-hero { padding-block: var(--labo-space-7) var(--labo-space-6); }
.mdy-financement-hero__grid { display: grid; gap: var(--labo-space-6); align-items: center; }
@media (min-width: 1000px) {
  .mdy-financement-hero__grid { grid-template-columns: minmax(0, 1fr) auto; }
}
.mdy-financement-scope { margin: 0; color: var(--labo-text); }
.mdy-financement-scope strong { color: var(--labo-glow-start); }
.mdy-financement-partner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--labo-space-3);
  justify-self: start;
  padding: var(--labo-space-4) var(--labo-space-5);
  border: var(--labo-border-width-hairline) solid var(--labo-border-strong);
  border-radius: var(--labo-radius-md);
  background: var(--labo-surface);
  color: var(--labo-text);
  font-size: var(--labo-font-size-small);
  font-weight: var(--labo-font-weight-semibold);
  text-decoration: none;
  transition: border-color var(--labo-motion-fast);
}
.mdy-financement-partner:hover { border-color: var(--labo-text-muted); }
/* The Qualiopi logo keeps its original white plate. */
.mdy-financement-partner__mark {
  display: block;
  width: auto;
  height: 47px;
  padding: 5px 7px;
  border-radius: var(--labo-radius-xs);
  background: var(--labo-palette-white);
}
@media (max-width: 700px) {
  .mdy-financement-partner { flex-direction: row; }
}

.mdy-financement-form { padding: 0; }
.mdy-financement-form > form { gap: 0; }
@media (min-width: 1000px) {
  .mdy-financement-form > form { grid-template-columns: 250px minmax(0, 1fr); }
}
.mdy-financement-rail {
  display: grid;
  align-content: start;
  gap: var(--labo-space-3);
  padding: var(--labo-space-5);
  border-bottom: var(--labo-border-width-hairline) solid var(--labo-border);
  border-radius: var(--labo-radius-lg) var(--labo-radius-lg) 0 0;
  background: color-mix(in srgb, var(--labo-glow-start) 6%, var(--labo-surface));
}
@media (min-width: 1000px) {
  .mdy-financement-rail {
    border-bottom: 0;
    border-inline-end: var(--labo-border-width-hairline) solid var(--labo-border);
    border-radius: var(--labo-radius-lg) 0 0 var(--labo-radius-lg);
  }
}
.mdy-financement-rail__count { color: var(--labo-text); font-family: var(--labo-font-display); font-weight: var(--labo-font-weight-bold); }
.mdy-financement-rail__steps {
  display: grid;
  gap: var(--labo-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: mdy-fin-step;
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-small);
}
.mdy-financement-rail__steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--labo-space-3);
  align-items: center;
  counter-increment: mdy-fin-step;
}
.mdy-financement-rail__steps li::before {
  content: counter(mdy-fin-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: var(--labo-border-width-hairline) solid var(--labo-border-strong);
  border-radius: var(--labo-radius-pill);
  font-family: var(--labo-font-mono);
  font-size: var(--labo-font-size-caption);
}
.mdy-financement-rail__steps li[data-complete] { color: var(--labo-text); }
.mdy-financement-rail__steps li[data-complete]::before { border-color: var(--labo-glow-start); color: var(--labo-glow-start); }
.mdy-financement-rail__steps li[aria-current="step"] { color: var(--labo-text); font-weight: var(--labo-font-weight-semibold); }
.mdy-financement-rail__steps li[aria-current="step"]::before { border-color: var(--labo-action); background: var(--labo-action); color: var(--labo-action-text); }
.mdy-financement-rail__note { margin: 0; color: var(--labo-text-muted); font-size: var(--labo-font-size-small); }
@media (max-width: 999px) {
  .mdy-financement-rail__steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mdy-financement-rail__steps li { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; font-size: var(--labo-font-size-caption); }
  .mdy-financement-rail__note { display: none; }
}
@media (max-width: 560px) {
  .mdy-financement-rail__steps li { font-size: 0; }
}
.mdy-financement-pane { display: grid; min-width: 0; padding: clamp(var(--labo-space-5), 4vw, var(--labo-space-7)); }
.mdy-financement-pane > .mdy-isolated-step { gap: var(--labo-space-5); }
.mdy-financement-pane [data-branch] { display: grid; gap: var(--labo-space-5); }
.mdy-financement-result { padding: clamp(var(--labo-space-5), 4vw, var(--labo-space-7)); }
.mdy-financement-result .labo9-steps { justify-self: stretch; max-width: 60ch; margin-inline: auto; text-align: start; }
.mdy-financement-result a:not(.labo9-button) { color: var(--labo-text); text-decoration: underline; text-underline-offset: 0.2em; }

.mdy-financement-measure { max-width: 880px; }
.mdy-financement-program { display: grid; gap: var(--labo-space-5); max-width: 880px; }
.mdy-financement-program__title { margin: 0; font-size: clamp(var(--labo-font-size-title-3), 2.6vw, var(--labo-font-size-title-2)); }
.mdy-financement-program > p { margin: 0; color: var(--labo-text-muted); font-size: var(--labo-font-size-lead); }
.mdy-financement-program .labo9-step strong { display: block; color: var(--labo-text); font-family: var(--labo-font-display); font-size: var(--labo-font-size-lead); }
.mdy-financement-program .labo9-step > span { color: var(--labo-text-muted); }
.mdy-financement-program__note {
  margin: 0;
  padding-block-start: var(--labo-space-4);
  border-top: var(--labo-border-width-hairline) solid var(--labo-border);
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-small);
}
.mdy-financement-faq a { color: var(--labo-text); text-decoration: underline; text-underline-offset: 0.2em; }

/* 5. Confirmation /merci-rdv/, a standalone page without the site chrome ------------------------ */
.mdy-merci-rdv { display: flex; flex-direction: column; min-height: 100svh; }
.mdy-merci-rdv__header { display: flex; justify-content: center; padding: var(--labo-space-6) var(--mdy-gutter); }
.mdy-merci-rdv__brand { display: inline-flex; align-items: center; min-height: var(--labo-target-min); border-radius: var(--labo-radius-xs); }
.mdy-merci-rdv__brand img { display: block; width: 146px; height: auto; }
.mdy-merci-rdv__main {
  position: relative;
  isolation: isolate;
  display: grid;
  flex: 1;
  place-items: center;
  padding: var(--labo-space-7) var(--mdy-gutter) var(--labo-space-8);
  outline: none;
}
.mdy-merci-rdv__main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 10%;
  background: radial-gradient(closest-side, var(--labo-glow-halo), transparent);
  opacity: 0.5;
  pointer-events: none;
}
.mdy-merci-rdv__panel {
  display: grid;
  gap: var(--labo-space-4);
  justify-items: center;
  width: 100%;
  max-width: 38rem;
  text-align: center;
}
.mdy-merci-rdv__status {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-block-end: var(--labo-space-3);
  border: var(--labo-border-width-hairline) solid var(--labo-glow-teal);
  border-radius: var(--labo-radius-pill);
  background: color-mix(in srgb, var(--labo-glow-teal) 10%, transparent);
  box-shadow: 0 0 var(--labo-space-6) color-mix(in srgb, var(--labo-glow-teal) 30%, transparent);
  color: var(--labo-glow-teal);
}
.mdy-merci-rdv__title {
  margin: 0;
  font-family: var(--labo-font-display);
  font-size: clamp(var(--labo-font-size-title-1), 6vw, var(--labo-font-size-hero));
  line-height: var(--labo-line-height-tight);
  letter-spacing: var(--labo-letter-spacing-display);
  text-wrap: balance;
}
.mdy-merci-rdv__email { margin: 0; color: var(--labo-text-muted); font-size: var(--labo-font-size-lead); }
.mdy-merci-rdv__return { margin-block-start: var(--labo-space-4); }
.mdy-merci-rdv__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--labo-space-2) var(--labo-space-5);
  padding: var(--labo-space-3) var(--mdy-gutter) calc(var(--labo-space-3) + var(--labo-safe-area-bottom));
  border-top: var(--labo-border-width-hairline) solid var(--labo-border);
}
.mdy-merci-rdv__footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--labo-target-min);
  color: var(--labo-text-muted);
  font-size: var(--labo-font-size-small);
  text-decoration: none;
}
.mdy-merci-rdv__footer a:hover { color: var(--labo-text); }

/* 6. 404 ------------------------------------------------------------------------------------------ */
.mdy-notfound {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding-block: var(--labo-space-8) var(--labo-space-7);
  text-align: center;
}
.mdy-notfound::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -20% 0 auto;
  height: 110%;
  background: radial-gradient(closest-side, var(--labo-glow-halo), transparent);
  opacity: 0.6;
  pointer-events: none;
}
.mdy-notfound__inner { display: grid; gap: var(--labo-space-5); justify-items: center; max-width: var(--labo-container-narrow); margin-inline: auto; }
.mdy-notfound__number {
  margin: 0 0 calc(-1 * var(--labo-space-4));
  background-image: linear-gradient(100deg, var(--labo-glow-start), var(--labo-glow-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-family: var(--labo-font-display);
  font-size: clamp(96px, 20vw, 200px);
  font-weight: var(--labo-font-weight-bold);
  line-height: 1;
  letter-spacing: var(--labo-letter-spacing-display);
  opacity: 0.45;
}
.mdy-notfound__title {
  margin: 0;
  font-size: clamp(var(--labo-font-size-title-1), 6vw, var(--labo-font-size-hero));
  line-height: var(--labo-line-height-tight);
  letter-spacing: var(--labo-letter-spacing-display);
}
.mdy-notfound__lead { max-width: 52ch; margin: 0; color: var(--labo-text-muted); font-size: var(--labo-font-size-lead); line-height: var(--labo-line-height-reading); }
.mdy-notfound__links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--labo-space-2); margin: 0; color: var(--labo-text-muted); }
.mdy-notfound__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--labo-target-min);
  padding-inline: var(--labo-space-2);
  color: var(--mdy-link);
  font-weight: var(--labo-font-weight-semibold);
  text-decoration: none;
}
.mdy-notfound__links a:hover { color: var(--labo-text); }

@media (prefers-reduced-motion: reduce) {
  .mdy-financement-partner { transition: none; }
}
