/* Labo : habillage aligné sur le site React (direction « couleur affirmée »).
   Chargé après les feuilles du design system et legacy.css : il remplace l'en-tête et le pied de
   page par ceux du site, et passe le haut de chaque outil en aplat rouge tramé. Le contenu des
   outils (formulaires, aperçus, scripts) n'est pas touché. */

:root, [data-theme="light"] {
  --accent: #c2321a;
  --accent-hover: #a52914;
  --brand: #c2321a;
  --lb-brand: #c2321a;
  --lb-rose: #ffe8e2;
  --lb-paper: #fafaf9;
  --lb-ink: #111111;
  --lb-ease: cubic-bezier(.16, 1, .3, 1);
}
html { scroll-padding-top: 88px; }
body { background: var(--lb-paper); }

/* Trame de planche technique, comme sur le site */
.lb-blueprint {
  background-color: var(--lb-brand);
  background-image:
    linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 240px 240px, 240px 240px, 48px 48px, 48px 48px;
  background-position: -1px -1px;
}
.lb-poster { font-family: "Instrument Sans", system-ui, sans-serif; font-weight: 700; font-stretch: 75%; font-variation-settings: "wdth" 75; letter-spacing: -.02em; }
.lb-mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- En-tête : pleine largeur sur l'aplat, pilule claire dès qu'on défile ---------- */
.lb-nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; justify-content: center; padding: 8px 8px 0; pointer-events: none; }
.lb-nav__bar {
  pointer-events: auto; position: relative; width: 100%; max-width: 1440px; color: #fff;
  background: rgba(250, 250, 249, 0); border-radius: 0;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: max-width .6s var(--lb-ease), background-color .4s, border-radius .6s var(--lb-ease), box-shadow .4s, color .3s;
}
.lb-nav[data-compact="true"] .lb-nav__bar, .lb-nav[data-open="true"] .lb-nav__bar { color: var(--lb-ink); background: rgba(250, 250, 249, .9); }
.lb-nav[data-open="true"] .lb-nav__bar { border-radius: 28px; box-shadow: 0 1px 0 rgba(17, 17, 17, .06), 0 18px 40px -24px rgba(17, 17, 17, .35); }
.lb-nav[data-compact="true"] .lb-nav__bar { max-width: 1040px; border-radius: 32px; box-shadow: 0 1px 0 rgba(17, 17, 17, .06), 0 18px 40px -24px rgba(17, 17, 17, .35); }
.lb-nav__row { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 56px; padding: 0 8px 0 16px; transition: padding .6s var(--lb-ease); }
.lb-nav__brand { display: block; flex-shrink: 0; color: inherit; }
.lb-nav__brand svg { display: block; height: 28px; width: auto; --cut: var(--lb-brand); }
.lb-nav[data-compact="true"] .lb-nav__brand svg, .lb-nav[data-open="true"] .lb-nav__brand svg { --cut: var(--lb-paper); }
.lb-nav__links { display: none; }
.lb-nav__links a { position: relative; display: block; padding: 8px 16px; border-radius: 999px; color: inherit; font-size: 15px; font-weight: 500; text-decoration: none; transition: background-color .25s; }
.lb-nav__links a:hover { background: rgba(255, 255, 255, .15); }
.lb-nav[data-compact="true"] .lb-nav__links a:hover { background: rgba(17, 17, 17, .06); }
.lb-nav__links a[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.lb-nav__end { display: flex; align-items: center; gap: 8px; }
.lb-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color .3s, color .3s;
  background: #fff; color: var(--lb-ink);
}
.lb-btn:hover { background: var(--lb-rose); }
.lb-nav[data-compact="true"] .lb-btn { background: var(--lb-brand); color: #fff; }
.lb-nav[data-compact="true"] .lb-btn:hover { background: #a52914; }
.lb-nav__end .lb-btn { display: none; }
.lb-nav__menu { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border: 0; background: none; color: inherit; cursor: pointer; font: 500 12px/1 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
/* En haut de page, le bouton est sur l'aplat rouge : on le dit explicitement (même rendu), pour que
   le texte blanc soit évalué sur le rouge et non sur le papier de la page */
.lb-nav:not([data-compact="true"]):not([data-open="true"]) .lb-nav__menu,
.lb-nav:not([data-compact="true"]):not([data-open="true"]) .lb-nav__links a { background-color: var(--lb-brand); border-radius: 999px; }
.lb-nav:not([data-compact="true"]):not([data-open="true"]) .lb-nav__links a:hover { background-color: #cb513c; }
.lb-burger { position: relative; display: block; width: 20px; height: 12px; }
.lb-burger::before, .lb-burger::after { content: ""; position: absolute; left: 0; width: 20px; height: 1px; background: currentColor; transition: transform .3s; }
.lb-burger::before { top: 0; } .lb-burger::after { bottom: 0; }
.lb-nav[data-open="true"] .lb-burger::before { transform: translateY(5.5px) rotate(45deg); }
.lb-nav[data-open="true"] .lb-burger::after { transform: translateY(-5.5px) rotate(-45deg); }
.lb-nav__panel { padding: 8px 16px 24px; }
.lb-nav__panel[hidden] { display: none; }
.lb-nav__panel ul { margin: 0; padding: 0; list-style: none; }
.lb-nav__panel li { border-top: 1px solid rgba(17, 17, 17, .1); }
.lb-nav__panel a:not(.lb-btn) { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; color: var(--lb-ink); text-decoration: none; font-family: "Instrument Sans", sans-serif; font-weight: 700; font-stretch: 82%; font-variation-settings: "wdth" 82; font-size: 32px; line-height: 1; }
.lb-nav__panel a span { font: 500 12px "IBM Plex Mono", monospace; color: #6b6b66; }
.lb-nav__panel .lb-btn { width: 100%; height: 44px; margin-top: 16px; background: var(--lb-brand); color: #fff; }
@media (min-width: 640px) { .lb-nav__end .lb-btn { display: inline-flex; } }
@media (min-width: 768px) { .lb-nav { padding: 12px 16px 0; } .lb-nav__row { height: 64px; padding: 0 24px; } .lb-nav[data-compact="true"] .lb-nav__row { padding: 0 8px 0 24px; } .lb-nav__brand svg { height: 32px; } }
@media (min-width: 1024px) { .lb-nav__links { display: flex; } .lb-nav__menu, .lb-nav__panel { display: none !important; } }

/* L'ancien en-tête n'existe plus : le contenu démarre sous la barre fixe */
.tool-hero, .section.hero { position: relative; overflow: clip; color: #fff; }

/* ---------- Haut de page des outils : l'aplat rouge tramé ---------- */
.tool-hero {
  background-color: var(--lb-brand);
  background-image:
    linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 240px 240px, 240px 240px, 48px 48px, 48px 48px;
  background-position: -1px -1px;
  padding-block: 128px 64px !important;
  border: 0 !important;
}
.tool-hero .eyebrow { color: var(--lb-rose) !important; font-family: "IBM Plex Mono", monospace; }
.tool-hero .eyebrow::before { background: #fff !important; }
.tool-hero h1 {
  color: #fff !important; font-family: "Instrument Sans", system-ui, sans-serif; font-weight: 700; font-stretch: 75%; font-variation-settings: "wdth" 75;
  letter-spacing: -.02em; line-height: .9 !important; font-size: clamp(48px, 8vw, 128px) !important; max-width: 14ch !important;
}
.tool-hero .lede, .tool-hero p:not(.eyebrow) { color: #fff !important; max-width: 56ch; font-size: clamp(17px, 1.5vw, 21px); }
.tool-hero a { color: #fff; }
.tool-hero .badges li, .tool-hero .tb-tag { background: transparent !important; color: #fff !important; border-color: rgba(255, 255, 255, .5) !important; }
.tool-hero .badges li::before { background: #fff !important; }
@media (min-width: 900px) { .tool-hero { padding-block: 168px 88px !important; } }

/* ---------- Index du Labo : même aplat pour son haut de page ---------- */
.section.hero { background-color: var(--lb-brand); padding-top: 128px !important; }
.section.hero, .section.hero * { --text: #ffe8e2; --text-strong: #fff; --text-muted: #ffe8e2; --border: rgba(255, 255, 255, .35); }
.section.hero {
  background-image:
    linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 240px 240px, 240px 240px, 48px 48px, 48px 48px;
}
.section.hero .hero__title { color: #fff; font-weight: 700; font-stretch: 75%; font-variation-settings: "wdth" 75; letter-spacing: -.02em; line-height: .88; }
.section.hero .tb-eyebrow, .section.hero .tb-eyebrow a { color: var(--lb-rose); }
.section.hero .tb-btn { background: #fff; color: var(--lb-ink); }
.section.hero .tb-tag { background: transparent !important; color: #fff !important; border-color: rgba(255, 255, 255, .5) !important; }
.section.hero .tb-tag::before { background: #fff !important; }

/* ---------- Pied de page : l'aplat revient, le nom signe la page ---------- */
.lb-footer { position: relative; overflow: hidden; color: #fff; font-family: "Instrument Sans", system-ui, sans-serif; }
.lb-footer a { color: inherit; text-decoration: none; }
.lb-footer .lb-btn { color: var(--lb-ink); }
.lb-wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .lb-wrap { padding: 0 40px; } }
.lb-footer__cta { display: flex; flex-direction: column; align-items: flex-start; gap: 32px; padding: 80px 0 56px; border-bottom: 1px solid rgba(255, 255, 255, .35); }
.lb-footer__cta p { margin: 0; max-width: 16ch; font-size: clamp(44px, 6vw, 92px); line-height: .92; color: #fff; }
.lb-footer__act { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.lb-footer__act .lb-btn { height: 56px; padding: 0 28px; font-size: 16px; }
.lb-footer__mail { font: 13px "IBM Plex Mono", monospace; color: var(--lb-rose); text-decoration: underline !important; text-decoration-color: rgba(255, 255, 255, .3) !important; text-underline-offset: 4px; }
.lb-footer__cols { display: grid; gap: 40px; padding: 56px 0; }
.lb-footer__cols p { margin: 0; }
.lb-footer__status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; font: 12px "IBM Plex Mono", monospace; }
.lb-footer__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.lb-footer__tag { margin-top: 20px !important; max-width: 30ch; color: var(--lb-rose); }
.lb-footer__cols h2 { margin: 0; font: 500 12px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--lb-rose); }
.lb-footer__cols ul { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.lb-footer__cols li a { background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat; transition: background-size .5s; }
.lb-footer__cols li a:hover { background-size: 100% 1px; }
.lb-footer__wm { display: block; width: 100%; height: auto; color: #fff; transform: translateY(var(--lb-wm, 0%)); }
.lb-footer__legal { display: flex; flex-direction: column; gap: 12px; padding: 24px 0; border-top: 1px solid rgba(255, 255, 255, .35); font: 12px "IBM Plex Mono", monospace; color: var(--lb-rose); }
.lb-footer__legal p { margin: 0; display: flex; gap: 24px; flex-wrap: wrap; }
.lb-footer__legal a:hover { color: #fff; }
@media (min-width: 640px) { .lb-footer__cols { grid-template-columns: 1fr 1fr; } .lb-footer__legal { flex-direction: row; justify-content: space-between; } }
@media (min-width: 768px) {
  .lb-footer__cta { flex-direction: row; justify-content: space-between; align-items: flex-end; padding-top: 112px; }
  .lb-footer__act { align-items: flex-end; }
  .lb-footer__cols { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .lb-nav__bar, .lb-footer__wm { transition: none !important; transform: none !important; }
}

/* ---------- Fil d'Ariane des outils (à la place de l'ancien surtitre) ---------- */
.lb-crumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 20px; padding: 0; list-style: none; font: 500 12px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--lb-rose); }
.lb-crumb li + li::before { content: "/"; margin-right: 10px; opacity: .6; }
.tool-hero .lb-crumb a { color: var(--lb-rose); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .4); text-underline-offset: 4px; }
.tool-hero .lb-crumb a:hover { color: #fff; text-decoration-color: #fff; }
.lb-crumb [aria-current] { color: #fff; }

/* ---------- Outils voisins (maillage entre les outils) ---------- */
.lb-related { border-top: 1px solid rgba(17, 17, 17, .1); }
.lb-related .lb-mono { margin: 0; color: #6b6b66; }
.lb-related h2 { margin: 12px 0 0; font-size: clamp(36px, 4.4vw, 64px); line-height: .94; color: var(--lb-ink); }
.lb-related__grid { display: grid; gap: 1px; margin: 32px 0 0; padding: 0; list-style: none; background: rgba(17, 17, 17, .1); border: 1px solid rgba(17, 17, 17, .1); border-radius: 18px; overflow: hidden; }
.lb-related__grid a { position: relative; display: grid; align-content: start; gap: 6px; height: 100%; padding: 24px 56px 24px 24px; background: #fff; color: var(--lb-ink); text-decoration: none; transition: background-color .3s; }
.lb-related__grid a:hover { background: var(--lb-rose); }
.lb-related__grid a:focus-visible { outline: 2px solid var(--lb-brand); outline-offset: -4px; }
.lb-related__n { font: 500 12px "IBM Plex Mono", monospace; color: var(--lb-brand); }
.lb-related__grid strong { font-size: 20px; font-weight: 700; font-stretch: 82%; font-variation-settings: "wdth" 82; line-height: 1.1; }
.lb-related__p { color: #3a3a37; font-size: 15px; }
.lb-related__a { position: absolute; right: 24px; top: 24px; font-size: 18px; transition: transform .4s var(--lb-ease); }
.lb-related__grid a:hover .lb-related__a { transform: translateX(4px); }
.lb-related__all { margin: 20px 0 0; }
.lb-related__all a { color: var(--lb-ink); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(17, 17, 17, .3); text-underline-offset: 5px; }
.lb-related__all a:hover { text-decoration-color: currentColor; }
@media (min-width: 768px) { .lb-related__grid { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { .lb-related__a { transition: none; } }

/* ---------- Respiration entre le haut rouge et l'outil ----------
   L'ancien gabarit accolait l'outil à une introduction blanche (.flush). Sous l'aplat rouge, ça
   paraissait coupé : on rend l'espace. */
.tool-section.flush { padding-top: 48px; }
@media (max-width: 759px) { .tool-section.flush { padding-top: 28px; } }

/* ---------- Illustrations des cartes du Labo (planche technique, SVG dans la page) ---------- */
.lab-grid .tb-card__icon { display: none; }
.lb-vis {
  display: block; aspect-ratio: 2 / 1; margin: calc(var(--tb-card-pad) * -1) calc(var(--tb-card-pad) * -1) var(--space-5);
  background-color: #f2f1ee;
  background-image: linear-gradient(rgba(17, 17, 17, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 17, 17, .055) 1px, transparent 1px);
  background-size: 16px 16px; background-position: -1px -1px;
  border-bottom: 1px solid rgba(17, 17, 17, .1); border-radius: var(--radius-md) var(--radius-md) 0 0; overflow: hidden;
}
.lb-vis svg { display: block; width: 100%; height: 100%; transition: transform .7s var(--lb-ease); }
.tb-card:hover .lb-vis svg { transform: scale(1.04); }
.lb-vis .v-w { fill: #fff; stroke: #111; stroke-width: 1.5; stroke-linejoin: round; }
.lb-vis .v-l { fill: none; stroke: #111; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lb-vis .v-m { fill: none; stroke: rgba(17, 17, 17, .28); stroke-width: 1.5; stroke-linecap: round; }
.lb-vis .v-a { fill: none; stroke: var(--lb-brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.lb-vis .v-thick { stroke-width: 3.5; }
.lb-vis .v-inv { fill: none; stroke: #fff; stroke-linecap: round; }
.lb-vis .v-af { fill: var(--lb-brand); }
.lb-vis .v-ink { fill: #111; }
.lb-vis .v-soft { fill: rgba(17, 17, 17, .1); }
.lb-vis .v-t { font: 500 10px "IBM Plex Mono", monospace; letter-spacing: .06em; fill: #6b6b66; }
.lb-vis .v-ta { fill: var(--lb-brand); }
.lb-vis .v-big { font: 700 46px "Instrument Sans", system-ui, sans-serif; fill: #111; }
.lb-vis .v-aa { font: 700 17px "Instrument Sans", system-ui, sans-serif; fill: #111; }
.lb-vis .v-aa--inv { fill: #fff; }
/* Au survol, le détail rouge se redessine : le geste « le tracé » du site */
@keyframes lb-retrace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.tb-card:hover .lb-vis .v-a { animation: lb-retrace 1s var(--lb-ease); }
@media (prefers-reduced-motion: reduce) { .lb-vis svg { transition: none; } .tb-card:hover .lb-vis .v-a { animation: none; } .tb-card:hover .lb-vis svg { transform: none; } }

/* ---------- Thématiques de la page du Labo ----------
   D'après « Animated Tabs » (21st.dev, catégorie Tabs) : une pilule glisse sous la thématique
   choisie ; les outils qui ne correspondent pas s'effacent. */
.lb-filters { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin: 32px 0 8px; padding: 6px; width: fit-content; max-width: 100%; border: 1px solid rgba(17, 17, 17, .12); border-radius: 999px; background: #fff; }
.lb-filter { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: #3a3a37; cursor: pointer; font: 500 15px "Instrument Sans", system-ui, sans-serif; transition: color .3s; }
.lb-filter:hover { color: #111; }
.lb-filter[aria-pressed="true"] { color: #fff; }
.lb-filter:focus-visible { outline: 2px solid var(--lb-brand); outline-offset: 2px; }
.lb-filter__n { font: 500 11px "IBM Plex Mono", monospace; opacity: .7; }
.lb-filter[aria-pressed="true"] .lb-filter__n { opacity: 1; }
.lb-filters__pill { position: absolute; z-index: 0; top: 0; left: 0; border-radius: 999px; background: var(--lb-brand); transition: transform .5s var(--lb-ease), width .5s var(--lb-ease), height .5s var(--lb-ease); pointer-events: none; }
.lb-filters__status { margin: 0 0 24px; font: 12px "IBM Plex Mono", monospace; color: #6b6b66; }
.lab-grid > li { transition: opacity .35s, transform .45s var(--lb-ease); }
.lab-grid > li.lb-out { opacity: 0; transform: scale(.97); }
.lab-grid > li[hidden] { display: none; }
/* Mobile : les thématiques tiennent sur une ligne qui défile ; les outils passent en liste compacte
   (une colonne, icône à gauche) au lieu de deux colonnes trop étroites et très hautes */
@media (max-width: 759px) {
  .lb-filters { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .lb-filters::-webkit-scrollbar { display: none; }
  .lb-filter { flex: none; white-space: nowrap; }
  .lab-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lab-grid > .tb-card { --tb-card-pad: 20px; display: block; padding: var(--tb-card-pad); }
  .lab-grid > .tb-card > * { margin-top: 0; }
  .lab-grid > .tb-card > .lb-vis { aspect-ratio: 5 / 2; margin: calc(var(--tb-card-pad) * -1) calc(var(--tb-card-pad) * -1) 16px; }
  .lab-grid > .tb-card .tb-caption { margin-bottom: 6px; }
  .lab-grid > .tb-card .tb-title-lg { font-size: 19px; line-height: 1.2; }
  .lab-grid > .tb-card .tb-body { margin-top: 8px; max-width: none; font-size: 15px; line-height: 1.5; }
  .lab-grid > .tb-card .tb-card__meta { display: none; }
  .lab-grid > .tb-card .tb-card__link { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .lb-filters__pill, .lab-grid > li { transition: none; } }
