/* ==========================================================================
   Voilà — design system partagé
   Aucune dépendance. Modifier ici change tous les outils du site.
   ========================================================================== */

:root {
  --ink:        #14181F;
  --ink-soft:   #4A5261;
  --ink-faint:  #8B94A3;
  --line:       #E4E0D8;
  --paper:      #FDFBF7;
  --card:       #FFFFFF;
  --accent:     #F4623A;
  --accent-dk:  #D24A26;
  --accent-lt:  #FFF1EC;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(20,24,31,.05), 0 8px 24px rgba(20,24,31,.06);
  --shadow-lg:  0 2px 4px rgba(20,24,31,.05), 0 18px 48px rgba(20,24,31,.10);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dk); }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(253,251,247,.88);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 16px;
  height: 62px;
}

.brand {
  font-size: 21px; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.brand .dot { color: var(--accent); }

.header-spacer { flex: 1; }

.lang-switch {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; background: var(--card);
}
.lang-switch a {
  padding: 5px 12px; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--ink-faint);
}
.lang-switch a[aria-current="true"] { background: var(--ink); color: #fff; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 72px; padding: 28px 0 44px;
  font-size: 14px; color: var(--ink-faint);
}
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Typographie ---------- */

h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -.03em; margin: 0 0 12px; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 10px; }
.lede { font-size: clamp(16px, 2.2vw, 19px); color: var(--ink-soft); margin: 0 0 8px; max-width: 62ch; }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent-dk); background: var(--accent-lt);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 14px;
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ---------- Éditeur (2 colonnes) ---------- */

.editor {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  align-items: start;
  margin-top: 28px;
}
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
}
.hint { font-size: 12.5px; color: var(--ink-faint); margin: 6px 0 0; }

input[type="text"], textarea, select {
  width: 100%; font-family: var(--font); font-size: 15px;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none;
}
input[type="text"]:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt);
}
textarea { min-height: 190px; resize: vertical; line-height: 1.6; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 2px solid transparent; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  padding: 8px 14px; font-size: 14px; font-weight: 600;
  background: var(--paper); color: var(--ink-soft);
  border: 0; cursor: pointer; font-family: var(--font);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- Barre d'outils document ---------- */

.btn-sm { padding: 7px 12px; font-size: 13.5px; }

.doc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.doc-sep { flex: 1; min-width: 4px; }
.doc-bar .doc-save { border-color: var(--accent); color: var(--accent-dk); font-weight: 700; }
.doc-bar .doc-save:hover { background: var(--accent-lt); }

.doc-msg { font-size: 13px; color: var(--ink-faint); margin: 8px 0 0; min-height: 18px; }
.doc-msg.warn { color: var(--accent-dk); }

.doc-empty { font-size: 13.5px; color: var(--ink-faint); margin: 10px 0 0; }

.doc-list { list-style: none; margin: 10px 0 0; padding: 0; }
.doc-list li {
  display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); overflow: hidden;
}
.doc-list li.current { border-color: var(--accent); background: var(--accent-lt); }
.doc-list .doc-open {
  flex: 1; display: flex; align-items: baseline; gap: 8px;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 9px 11px; font-family: var(--font); font-size: 14px; color: var(--ink);
  min-width: 0;
}
.doc-list .doc-open:hover { background: rgba(0,0,0,.03); }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-date { margin-left: auto; font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.doc-list .doc-del {
  background: none; border: 0; cursor: pointer; padding: 0 12px;
  font-size: 20px; line-height: 1; color: var(--ink-faint); font-family: var(--font);
}
.doc-list .doc-del:hover { color: var(--accent-dk); background: rgba(0,0,0,.03); }
.doc-quota { font-size: 12.5px; color: var(--ink-faint); margin: 8px 0 0; }
.doc-quota strong { color: var(--accent-dk); }

/* ---------- Retour / fil d'ariane ---------- */

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: var(--ink);
  text-decoration: none; margin-top: 20px;
  padding: 9px 16px 9px 13px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow);
  transition: border-color .15s ease, color .15s ease, transform .06s ease;
}
.back-link .arrow {
  font-size: 16px; line-height: 1; color: var(--accent);
  transition: transform .15s ease;
}
.back-link:hover { border-color: var(--accent); color: var(--accent-dk); }
.back-link:hover .arrow { transform: translateX(-3px); }
.back-link:active { transform: translateY(1px); }

.site-nav { display: flex; align-items: center; gap: 16px; }
.site-nav a {
  font-size: 14.5px; font-weight: 600; color: var(--ink-soft); text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); }
.site-nav .short { display: none; }

/* Sur petit écran, les libellés raccourcissent au lieu de disparaître. */
@media (max-width: 680px) {
  .site-header .wrap { gap: 10px; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 13.5px; }
  .site-nav .full { display: none; }
  .site-nav .short { display: inline; }
  .lang-switch a { padding: 5px 9px; font-size: 12.5px; }
  .brand { font-size: 19px; }
}
@media (max-width: 400px) {
  .wrap { padding: 0 14px; }
  .site-nav { gap: 9px; }
}

.footer-cols {
  display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: baseline;
}
.footer-cols .spacer { flex: 1; }

/* ---------- Formulaire ---------- */

.form-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  max-width: 620px; margin-top: 26px;
}
.form-card textarea { min-height: 150px; }

/* Retour d'envoi : un bandeau franc plutôt qu'une ligne de texte grise,
   sinon personne ne remarque que le message est bien parti. */
.form-status {
  display: none; margin: 16px 0 0;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; line-height: 1.45;
  border: 1px solid transparent;
}
.form-status.is-visible { display: block; }
.form-status.pending { background: #F0F2F5; border-color: var(--line); color: var(--ink-soft); }
.form-status.ok      { background: #E7F6EE; border-color: #ADDFC6; color: #0E5C3A; }
.form-status.error   { background: #FDEBEB; border-color: #F5C4C4; color: #9E1F1F; }

/* ---------- Grille de saisie ---------- */

.grid-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper);
}
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
table.grid tr:last-child th, table.grid tr:last-child td { border-bottom: 0; }
table.grid th:last-child, table.grid td:last-child { border-right: 0; }

table.grid thead th {
  background: var(--card); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 700; text-align: center;
  padding: 8px 10px; white-space: nowrap;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
table.grid thead th.corner { text-align: left; color: var(--ink-faint); font-weight: 600; }

table.grid th.row-head {
  background: var(--card); color: var(--ink);
  font-size: 13.5px; font-weight: 600; text-align: left;
  padding: 8px 10px; max-width: 170px; min-width: 110px;
  position: sticky; left: 0; z-index: 1;
}

table.grid td { padding: 0; }
table.grid td input {
  border: 0; background: transparent; border-radius: 0;
  padding: 9px 10px; font-size: 14px; width: 100%; min-width: 88px;
  text-align: center; font-family: var(--font); color: var(--ink);
}
table.grid td input:focus { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
table.grid td input::placeholder { color: #C7CDD6; }

.grid-empty {
  padding: 18px; text-align: center; font-size: 14px; color: var(--ink-faint);
}

table.grid td.tight { width: 1%; white-space: nowrap; }
table.grid td input.left { text-align: left; }
.row-del {
  background: none; border: 0; cursor: pointer; padding: 0 11px;
  font-size: 19px; line-height: 1; color: var(--ink-faint); font-family: var(--font);
}
.row-del:hover { color: var(--accent-dk); }
.add-row { margin-top: 9px; }

/* ---------- Aperçu ---------- */

.preview-panel { position: sticky; top: 82px; }
@media (max-width: 900px) { .preview-panel { position: static; } }

.stage {
  background:
    linear-gradient(45deg, #F1EDE5 25%, transparent 25%, transparent 75%, #F1EDE5 75%),
    linear-gradient(45deg, #F1EDE5 25%, transparent 25%, transparent 75%, #F1EDE5 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; overflow: auto;
}
.stage svg { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow-lg); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.status { font-size: 13.5px; color: var(--ink-faint); margin: 10px 0 0; min-height: 20px; }

/* ---------- Grille d'outils ---------- */

.tool-grid {
  display: grid; gap: 14px; margin-top: 30px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.tool-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-decoration: none;
  color: var(--ink); box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tool-card h3 { margin: 0 0 5px; font-size: 16.5px; letter-spacing: -.01em; }
.tool-card p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.tool-card .ico { font-size: 22px; display: block; margin-bottom: 10px; }
.tool-card.soon { opacity: .55; pointer-events: none; }
.tool-card.soon::after {
  content: attr(data-soon); display: inline-block; margin-top: 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-faint);
}

/* ---------- Divers ---------- */

.notice {
  background: var(--accent-lt); border: 1px solid #F8D3C7;
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 14px; color: #8A3316; margin-top: 22px;
}
.hero { padding: 46px 0 6px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
