/* ==========================================================================
   Votre avis sur Tchap — feuille de styles (CSS natif)
   Charte « LaSuite × Marianne », palette « Option A — France ».
   Police Marianne (distribution officielle DSFR), graisses 300/400/500/700.
   ========================================================================== */

@font-face {
  font-family: "Marianne";
  src: url("assets/fonts/Marianne-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Marianne";
  src: url("assets/fonts/Marianne-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Marianne";
  src: url("assets/fonts/Marianne-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Marianne";
  src: url("assets/fonts/Marianne-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  --accent: #2845c1;
  --accent-hover: #223e9e;
  --accent-contrast: #ffffff;
  --accent-subtle: #eef1fb;
  --text: #181b24;
  --text-secondary: #555e74;
  --surface: #ffffff;
  --surface-alt: #f6f8f9;
  --border: #d5dae3;
  --border-strong: #9aa3b6;
  --error: #b3231c;
  --error-surface: #fdeceb;
  --star: #e1a325;
  --star-empty: #c3c9d4;

  --radius-control: 4px;
  --radius-card: 8px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font: "Marianne", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --shadow-card: 0 1px 2px rgba(24, 27, 36, 0.06), 0 6px 20px rgba(24, 27, 36, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8fa4f3;
    --accent-hover: #adbdf8;
    --accent-contrast: #10131c;
    --accent-subtle: #1e2536;
    --text: #f2f4f8;
    --text-secondary: #b6bdcd;
    --surface: #1b1f2a;
    --surface-alt: #10131c;
    --border: #39404f;
    --border-strong: #7b8398;
    --error: #ff8b84;
    --error-surface: #3a1e1d;
    --star: #f2c14e;
    --star-empty: #59606f;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--surface-alt);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

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

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-2);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control);
  z-index: 10;
}
.skip-link:focus {
  left: var(--space-4);
}

/* --------------------------------------------------------------------------
   En-tête / pied de page
   -------------------------------------------------------------------------- */
.site-header {
  display: flex;
  justify-content: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
}

.logo {
  display: block;
  width: auto;
  height: 72px;
  max-width: 100%;
}

@media (prefers-color-scheme: dark) {
  /* Le logo garde ses proportions ; un fond clair discret préserve sa lisibilité. */
  .logo {
    background: #ffffff;
    border-radius: var(--radius-card);
    padding: var(--space-2) var(--space-3);
    height: 84px;
  }
}

.main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 var(--space-4) var(--space-6);
}

.site-footer {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}
.site-footer p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Carte
   -------------------------------------------------------------------------- */
.card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6) var(--space-5) var(--space-5);
}

.card h1 {
  margin: 0 0 var(--space-3);
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.intro {
  margin: 0 0 var(--space-2);
  color: var(--text);
  font-weight: 300;
  font-size: 1.0625rem;
}

.mention {
  margin: 0 0 var(--space-5);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.avertissement {
  margin: var(--space-5) 0 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.rappel {
  margin: var(--space-5) 0 var(--space-4);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.noscript {
  border-left: 4px solid var(--error);
}

/* --------------------------------------------------------------------------
   Groupes de questions
   -------------------------------------------------------------------------- */
.groupe {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-6);
}

.groupe legend {
  padding: 0;
  margin-bottom: var(--space-3);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--text);
}

.erreur {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--error-surface);
  border-left: 4px solid var(--error);
  border-radius: var(--radius-control);
  color: var(--error);
  font-size: 0.9375rem;
  font-weight: 500;
}
.erreur[hidden] {
  display: none;
}

.erreur .icone {
  flex: 0 0 auto;
  margin-top: 2px;
}

.icone {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Question 1 : appareil
   -------------------------------------------------------------------------- */
.options-appareil {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 420px) {
  .options-appareil {
    grid-template-columns: 1fr;
  }
}

.option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.option label:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.option input[type="radio"]:focus-visible + label {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.option input[type="radio"]:checked + label {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-subtle);
}

/* La coche indique la sélection sans recourir à la couleur seule. */
.option .coche {
  width: 20px;
  height: 20px;
  margin-left: auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}
.option input[type="radio"]:checked + label .coche {
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Question 2 : note sur 10
   -------------------------------------------------------------------------- */
.etoiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.etoile {
  flex: 1 1 calc(10% - var(--space-1));
  min-width: 44px;
}

.etoile input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.etoile label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: var(--space-1) 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.etoile label:hover {
  background: var(--accent-subtle);
}

.etoile input[type="radio"]:focus-visible + label {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.svg-etoile {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--star-empty);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.etoile.pleine .svg-etoile {
  fill: var(--star);
  stroke: var(--star);
}

.chiffre {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.etoile input[type="radio"]:checked + label {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.etoile input[type="radio"]:checked + label .chiffre {
  color: var(--text);
  font-weight: 700;
}

.reperes {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.note-choisie {
  margin: var(--space-2) 0 0;
  min-height: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Petits écrans : deux rangées de cinq (1–5 puis 6–10), sans défilement. */
@media (max-width: 560px) {
  .etoile {
    flex: 0 0 calc(20% - var(--space-1));
  }
  .svg-etoile {
    width: 32px;
    height: 32px;
  }
}

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  height: auto;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.bouton-primaire {
  width: 100%;
  background: var(--accent);
  color: var(--accent-contrast);
}
.bouton-primaire:hover {
  background: var(--accent-hover);
}

.bouton-secondaire {
  width: 100%;
  margin-top: var(--space-1);
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.bouton-secondaire:hover {
  background: var(--accent-subtle);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
