/* ==========================================================================
   Feuille de style commune, écrite à la main (aucun style en ligne : la CSP
   n'autorise que les fichiers de /css).
   Identité : papier crème, vert sapin, laiton ; Fraunces pour les titres,
   Source Sans 3 pour le texte (auto-hébergées, servies par /fonts).
   Un module ajoute sa feuille public/css/<id>.css (bloc `head` du gabarit)
   et réutilise ces variables et ces classes.
   ========================================================================== */

/* --- Polices --------------------------------------------------------------- */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/fraunces-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/fraunces-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('/fonts/source-sans-3-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('/fonts/source-sans-3-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url('/fonts/source-sans-3-latin-wght-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Variables ----------------------------------------------------------------- */

:root {
  --paper: #fbf8f2;
  --surface: #ffffff;
  --sunken: #f3eee4;
  --ink: #23201d;
  --muted: #6b645b;
  --line: #e6dfd2;
  --line-strong: #cfc5b4;
  --primary: #1f5c57;
  --primary-hover: #164744;
  --primary-soft: #e2eeeb;
  --accent: #b9722a;
  --accent-soft: #f7ecdc;
  --ok: #2b6a3a;
  --ok-soft: #e4f1e6;
  --warn: #855600;
  --warn-soft: #fbf0d6;
  --danger: #a3392b;
  --danger-hover: #852c20;
  --danger-soft: #f8e5e1;
  --focus: #d9963f;
  --radius: 10px;
  --radius-small: 7px;
  --shadow: 0 1px 2px rgba(35, 32, 29, 0.06), 0 4px 14px rgba(35, 32, 29, 0.05);
  --font-text: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-title: 'Fraunces', Georgia, 'Times New Roman', serif;
  --width: 1120px;
  --width-text: 720px;
}

/* --- Base ---------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
}

code,
.mono {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.container {
  width: 100%;
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 16px;
}

.main {
  flex: 1 0 auto;
  padding-top: 28px;
  padding-bottom: 56px;
}

.main-landing {
  flex: 1 0 auto;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 15px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 8px;
  color: #fff;
}

/* --- En-tête et navigation -------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--primary);
}

.brand img {
  display: block;
  width: 36px;
  height: 36px;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a,
.nav-button {
  display: inline-block;
  padding: 7px 11px;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}

.main-nav a:hover,
.nav-button:hover {
  background: var(--sunken);
  color: var(--ink);
}

.main-nav a[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.main-nav .nav-cta {
  background: var(--primary);
  color: #fff;
}

.main-nav .nav-cta:hover {
  background: var(--primary-hover);
  color: #fff;
}

.nav-button {
  color: var(--muted);
}

.nav-form {
  margin: 0;
}

/* --- Titres et blocs ---------------------------------------------------------------------- */

.page-title {
  margin: 0 0 20px;
  font-size: 30px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.page-head .page-title {
  margin: 0;
}

.lead {
  font-size: 19px;
  color: var(--muted);
}

.breadcrumb {
  margin: 0 0 6px;
  font-size: 15px;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

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

.card + .card {
  margin-top: 20px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 21px;
}

.narrow {
  max-width: 560px;
}

.text-width {
  max-width: var(--width-text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  align-items: start;
}

.grid .card + .card {
  margin-top: 0;
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
}

.details dt {
  color: var(--muted);
  font-weight: 600;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  text-align: center;
}

.stack > * + * {
  margin-top: 16px;
}

/* --- Messages ------------------------------------------------------------------------------ */

.alert {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid;
  border-left-width: 5px;
  border-radius: var(--radius-small);
}

.alert > :last-child {
  margin-bottom: 0;
}

.alert-success {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.alert-error {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-hover);
}

.alert-info {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.alert-warn {
  border-color: var(--accent);
  background: var(--warn-soft);
  color: var(--warn);
}

/* --- Formulaires --------------------------------------------------------------------------- */

.form {
  margin: 0;
}

.field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-weight: 650;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='number'],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  /* 16 px au moins : sans quoi les téléphones agrandissent la page au toucher. */
  font-size: 16px;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid var(--primary-soft);
  outline-offset: 0;
}

.field-invalid input,
.field-invalid select {
  border-color: var(--danger);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0;
  cursor: pointer;
}

.checkbox input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger-hover);
  font-size: 15px;
  font-weight: 650;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.inline-form {
  display: inline;
  margin: 0;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.row-form .field {
  flex: 1 1 200px;
  margin: 0;
}

/* Champ piège de l'inscription : hors de la vue et du clavier, présent pour les robots. */
.piege {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: var(--sunken);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--line);
  color: var(--ink);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #9a5d1f;
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
  color: #fff;
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Tableaux -------------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.data-table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--sunken);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .actions {
  text-align: right;
  white-space: nowrap;
}

.data-table .actions > * + * {
  margin-left: 8px;
}

.cell-strong {
  font-weight: 650;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .table-wrap {
    border: 0;
    background: none;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 14px;
    text-align: right;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: left;
  }

  .data-table tbody tr:last-child td {
    border-bottom: 1px solid var(--line);
  }

  .data-table td.actions {
    justify-content: flex-end;
    border-bottom: 0;
  }

  .data-table td.actions::before {
    content: none;
  }
}

/* --- Pastilles et onglets ------------------------------------------------------------------------ */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.badge-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-active {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-disabled {
  background: var(--sunken);
  color: var(--muted);
}

.badge-admin {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.tabs a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.tabs a:hover {
  border-color: var(--primary);
}

.tabs a[aria-current='page'] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

/* --- Chiffres du tableau de bord --------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

a.stat:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.stat-value {
  display: block;
  font-family: var(--font-title);
  font-size: 34px;
  font-weight: 650;
  line-height: 1.1;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
}

.stat-attention .stat-value {
  color: var(--accent);
}

/* --- Secret affiché une fois ---------------------------------------------------------------------- */

.secret {
  display: block;
  margin: 12px 0 16px;
  padding: 14px 16px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  font-size: 20px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* --- Connexion, inscription ------------------------------------------------------------------------ */

.auth {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 460px;
}

.auth-card .page-title {
  text-align: center;
}

.auth-intro {
  margin: -8px 0 22px;
  color: var(--muted);
  text-align: center;
}

.auth-links {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

/* --- Page de vente ------------------------------------------------------------------------------------- */

.hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 85% 20%, rgba(217, 150, 63, 0.14), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(31, 92, 87, 0.1), transparent 50%),
    var(--paper);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 650;
  line-height: 1.05;
}

.hero-text {
  max-width: 34em;
  margin: 0 0 26px;
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.name-note {
  max-width: 34em;
  margin: 26px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
}

.name-note p {
  margin: 0;
}

.hero-figure {
  margin: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-figure img {
  display: block;
  width: 96px;
  height: 96px;
  margin-bottom: 18px;
}

.hero-figure ul {
  margin: 0;
  padding-left: 1.2em;
}

.hero-figure li + li {
  margin-top: 6px;
}

.section {
  padding: 48px 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-title {
  margin: 0 0 8px;
  font-size: 30px;
}

.section-intro {
  max-width: var(--width-text);
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 18px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 20px 20px 18px 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 19px;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

.trial {
  padding: 26px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.trial h2 {
  margin-top: 0;
}

.trial > :last-child {
  margin-bottom: 0;
}

/* --- Texte, erreurs, pages provisoires ----------------------------------------------------------------- */

.prose {
  max-width: var(--width-text);
}

.prose h2 {
  margin: 30px 0 8px;
  font-size: 22px;
}

.prose ul {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 4px;
}

.error-page {
  max-width: 560px;
  margin: 24px auto;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-title);
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
}

.soon {
  max-width: 620px;
  margin: 24px auto;
  text-align: center;
}

.soon img {
  width: 72px;
  height: 72px;
}

/* --- Pied de page --------------------------------------------------------------------------------------- */

.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer-inner p {
  margin: 0;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--ink);
}

/* --- Petits écrans ---------------------------------------------------------------------------------------- */

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .header-inner {
    min-height: 56px;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
  }

  .main-nav ul {
    flex-wrap: nowrap;
  }

  .main-nav a,
  .nav-button {
    white-space: nowrap;
  }

  .page-title {
    font-size: 25px;
  }

  .card {
    padding: 18px;
  }

  .hero {
    padding: 36px 0 32px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .section {
    padding: 34px 0;
  }

  .section-title {
    font-size: 25px;
  }

  .details {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .details dd {
    margin-bottom: 8px;
  }
}
