/* Site public de LibDic. Mêmes couleurs que l'appli (contrastes WCAG 2.1 AA vérifiés par
   scripts/tests/contrast-test.mjs pour l'appli). */
:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #17161a;
  --muted: #6d6a73;
  --line: #e4e0d7;
  --accent: #ff5a3c;
  --accent-strong: #b8341a;
  --ok: #1f9d68;
  --focus: #1f5fd1;
  /* Texte posé sur la couleur d'accent (boutons, pastilles) : contraste AA dans les deux thèmes. */
  --on-accent: #ffffff;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141317;
    --panel: #1d1c21;
    --ink: #f1eee8;
    --muted: #9b97a3;
    --line: #2e2c33;
    --accent-strong: #ff7a60;
    --ok: #3ccf8e;
    --focus: #7aa7ff;
    --on-accent: #17161a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--accent-strong);
}

header,
footer,
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "logo nav langs";
  align-items: center;
  gap: 12px 24px;
  padding-top: 18px;
  padding-bottom: 18px;
}

header > .logo {
  grid-area: logo;
}

header > nav:not(.langs) {
  grid-area: nav;
  justify-self: end;
}

/* Sélecteur de langue : à part de la navigation, compact. */
.langs {
  grid-area: langs;
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}

.langs a {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 999px;
  flex: none;
  white-space: nowrap;
}

.langs a[aria-current="true"] {
  background: var(--ink);
  color: var(--bg);
}

.langs a:hover {
  color: var(--ink);
}

.logo {
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  text-decoration: none;
}

.logo span {
  color: var(--accent);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav a {
  color: var(--ink);
  text-decoration: none;
}

nav a[aria-current="page"] {
  color: var(--accent-strong);
  font-weight: 600;
}

.hero {
  padding: 56px 0 8px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.1;
  margin: 0 0 16px;
}

.lead {
  font-size: 20px;
  color: var(--muted);
  max-width: 720px;
}

.button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-size: 16px;
}

/* Bouton pas encore actif (installateur pas encore publié) : visiblement inactif, pas cliquable. */
.button[aria-disabled="true"] {
  background: var(--line);
  color: var(--muted);
  pointer-events: none;
  cursor: default;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0 48px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.price {
  font-size: 32px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.price .muted {
  font-size: 16px;
  font-weight: 500;
}

/* Formules : quatre colonnes sur grand écran, boutons alignés en bas, Pro mis en avant. */
.plans {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.plans .card {
  display: flex;
  flex-direction: column;
}

.plans .card ul {
  padding-inline-start: 18px;
}

.plans .card .button {
  margin-top: auto;
  align-self: flex-start;
}

.plans .price {
  margin: 8px 0 4px;
}

.featured {
  border: 2px solid var(--accent-strong);
}

.badge {
  align-self: flex-start;
  margin: 0 0 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  text-align: start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.status {
  min-height: 1.6em;
}

.error {
  color: var(--accent-strong);
}

footer {
  margin-top: 64px;
  padding-top: 24px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

footer p {
  margin: 6px 0;
}

.foot-brand .logo {
  font-size: 18px;
  margin-inline-end: 8px;
}

.small {
  font-size: 14px;
}

h2 {
  line-height: 1.25;
}

main > section {
  margin: 56px 0;
}

main > section.hero {
  margin-top: 0;
  margin-bottom: 32px;
}

/* Sommaire d'une page (aide) : sujets en pastilles. */
main nav ul {
  gap: 8px;
}

main nav a {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
}

main nav a:hover {
  border-color: var(--accent-strong);
}

/* Exemples : ce que tu dis, ce que LibDic écrit. */
.demo-rows {
  display: grid;
  gap: 12px;
}

.demo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.demo-row p {
  margin: 0;
  padding: 16px 20px;
}

.demo-row .said {
  color: var(--muted);
  font-style: italic;
  border-inline-end: 1px solid var(--line);
}

.demo-row .written {
  font-weight: 500;
}

.tag {
  display: block;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.written .tag {
  color: var(--accent-strong);
}

.field {
  display: inline-block;
  min-width: 72px;
  margin: 2px 0;
  margin-inline-end: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

/* Comment ça marche. */
.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 0;
  margin: 0;
}

.steps li {
  counter-increment: step;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-weight: 700;
  margin-bottom: 12px;
}

.steps strong,
.steps span {
  display: block;
}

.steps span {
  color: var(--muted);
}

/* Tableaux. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Appel final. */
.cta {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
}

.cta h2 {
  margin-top: 0;
  font-size: clamp(24px, 4vw, 32px);
}

.cta .button {
  margin: 4px;
}

.hero .button {
  margin: 4px 0;
  margin-inline-end: 8px;
}

/* Téléphone : logo et langues sur une ligne, menu défilant sur la suivante. */
@media (max-width: 720px) {
  header {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "logo langs" "nav nav";
  }

  header > nav:not(.langs) {
    justify-self: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -20px;
    padding: 0 20px;
  }

  /* Sept langues : le sélecteur défile s'il ne tient pas à côté du logo. */
  .langs {
    justify-self: end;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  header > nav:not(.langs) ul {
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .demo-row {
    grid-template-columns: 1fr;
  }

  .demo-row .said {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  main > section {
    margin: 40px 0;
  }
}

/* Chinois, hindi, arabe : polices système de chaque écriture (aucune police externe : CSP du site). */
html:lang(zh) body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html:lang(hi) body {
  font-family: system-ui, -apple-system, "Nirmala UI", "Kohinoor Devanagari", "Noto Sans Devanagari", sans-serif;
  line-height: 1.75;
}

html:lang(ar) body {
  font-family: system-ui, -apple-system, "Segoe UI", "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif;
  line-height: 1.75;
}

/* L'espacement des lettres casse la liaison des lettres arabes. */
html:lang(ar) .tag,
html:lang(ar) .badge,
html:lang(ar) [hidden] {
  display: none !important;
}
