/* ==========================================================================
   Positive Solutions — Workplace Check questionnaire
   CSS derived from the design system tokens and screen markup.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Nunito:wght@600;700&display=swap");

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --bg: #ffffff;
  --surface-mint: #f1f7f3;
  --surface-mint-2: #e3f0e8;
  --border: #d5e6db;
  --ink: #303030;
  --ink-muted: #5b6b63;
  --border-control: var(--ink-muted);
  --green-400: #4fa07a;   /* graphics only */
  --green-600: #2f7d5b;   /* icons, hover borders */
  --green-700: #256b4d;   /* primary, links, focus */
  --green-800: #1f5c42;   /* text on mint, primary hover */
  --brand-orange: #ec6430; /* logo / shapes / icons >= 24px */
  --orange-700: #c2410c;  /* conversion button, "attention" */
  --amber: #d97706;       /* "watch" level, always icon + label */
  --alert-red: #b42318;
  --navy: #1c2874;        /* Qualiopi badge only */
  --on-fill: #ffffff;
  --focus: var(--green-700);

  /* Type */
  --font-heading: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing (8px grid) */
  --space-half: 4px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  /* Radius */
  --radius-input: 12px;
  --radius-card: 16px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.08);
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #256b4d;

  /* Size */
  --touch-min: 48px;
  --icon: 24px;
  --icon-stroke: 2px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
}

a { color: var(--green-700); }
a:hover { color: var(--green-800); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
button:focus-visible,
.btn:focus-visible,
.pill:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Typography ---------- */
h1, h2, h3, .h1, .h2, .h3 {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--ink);
  text-wrap: balance;
}
.h1-desktop { font-size: 44px; line-height: 52px; font-weight: 700; }
h1, .h1     { font-size: 28px; line-height: 34px; font-weight: 700; }
h2, .h2     { font-size: 22px; line-height: 28px; font-weight: 700; }
h3, .h3     { font-size: 18px; line-height: 26px; font-weight: 600; }

p { margin: 0; text-wrap: pretty; }
.body-lg     { font-size: 18px; line-height: 28px; font-weight: 400; }
.body        { font-size: 16px; line-height: 24px; font-weight: 400; }
.body-strong { font-size: 16px; line-height: 24px; font-weight: 600; }
.caption     { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.label       { font-family: var(--font-heading); font-size: 16px; line-height: 24px; font-weight: 700; }

/* Hero title with green frame (intro screen) */
.title-frame {
  padding: 12px 16px;
  border: 2px solid var(--green-600);
  border-radius: var(--radius-card);
  text-align: center;
}

@media (min-width: 900px) {
  h1.hero, .h1.hero { font-size: 44px; line-height: 52px; }
}

/* ---------- Layout ---------- */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.screen__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 8px 4px 0;
}
.screen__main {
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: var(--space-3) var(--space-2) 12px;
}
.stack    { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-1); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-3); }
.row      { display: flex; align-items: center; gap: var(--space-1); }

.section        { padding: var(--space-6) var(--space-2); }
.section--mint  { background: var(--surface-mint); }
@media (min-width: 900px) {
  .section { padding: var(--space-8) var(--space-4); }
  .container { max-width: 1120px; margin-inline: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  padding: 12px var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn--block { width: 100%; }

.btn--primary { background: var(--green-700); color: var(--on-fill); }
.btn--primary:hover { background: var(--green-800); color: var(--on-fill); }

/* Conversion button: one orange action per screen */
.btn--conversion {
  background: var(--orange-700);
  color: var(--on-fill);
  box-shadow: var(--shadow-card);
}
.btn--conversion:hover { filter: brightness(0.92); color: var(--on-fill); }

.btn--secondary {
  background: var(--bg);
  color: var(--green-700);
  box-shadow: inset 0 0 0 2px var(--green-700);
}
.btn--secondary:hover { background: var(--surface-mint); color: var(--green-800); }

.btn--ghost { background: transparent; color: var(--green-700); }
.btn--ghost:hover { background: var(--surface-mint); color: var(--green-800); }

.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Round icon button (back / close) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-mint); }

/* ---------- Icons ---------- */
.icon {
  width: var(--icon);
  height: var(--icon);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--accent { stroke: var(--green-600); }
.icon--brand  { stroke: var(--brand-orange); }

/* ---------- Check list ---------- */
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.check-list > li { display: flex; align-items: flex-start; gap: 12px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
}
.card--compact { padding: var(--space-2); }
.card--mint    { background: var(--surface-mint); box-shadow: none; }
@media (min-width: 900px) { .card--large { padding: var(--space-4); } }

/* Notes / panels */
.note {
  display: flex;
  gap: 12px;
  padding: var(--space-2);
  border-radius: var(--radius-card);
  background: var(--surface-mint);
  color: var(--ink);
}
.note__title { color: var(--green-800); }
.note--safety { color: var(--alert-red); }
.note--safety .note__title { color: var(--alert-red); }

/* Chips / topic tag */
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-mint);
  color: var(--green-800);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

/* ---------- Progress ---------- */
.progress {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-mint-2);
}
.progress__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--green-700);
}

/* ---------- Answer pills (radio) ---------- */
.pill-group { display: flex; flex-direction: column; gap: var(--space-1); }

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 20px 6px 24px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border-control);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.pill:hover { background: var(--surface-mint); }
.pill[aria-checked="true"] {
  background: var(--surface-mint-2);
  box-shadow: inset 0 0 0 2px var(--green-700);
  font-weight: 600;
}
.pill[aria-checked="true"]:focus-visible { box-shadow: var(--focus-ring); }
.pill .icon { stroke: var(--green-700); }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  min-height: var(--touch-min);
  padding: 10px 14px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
}
.input[aria-invalid="true"] { border-color: var(--alert-red); }
.error-text { color: var(--alert-red); font-size: 16px; line-height: 24px; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--touch-min);
  padding: 12px 16px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
}
.consent-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--green-700);
  cursor: pointer;
}

/* ---------- Result levels (icon + written label, never color alone) ---------- */
.level            { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 600; }
.level--strength  .icon { stroke: var(--green-400); }
.level--watch     .icon { stroke: var(--amber); }
.level--attention { color: var(--orange-700); }
.level--attention .icon { stroke: var(--orange-700); }

.chart-fill   { fill: var(--green-400); }
.chart-stroke { stroke: var(--green-600); }
.chart-label  { font-size: 13px; line-height: 18px; font-weight: 500; fill: var(--ink-muted); }

/* ---------- Floating layers ---------- */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 12px var(--space-2);
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-raised);
}

.tab-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 4px 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
}
.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  text-decoration: none;
}
.tab-bar__item[aria-current="page"] { color: var(--green-700); font-weight: 600; }

/* ---------- Lists / links ---------- */
.list-card {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.list-card > li + li { border-top: 1px solid var(--border); }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 12px 8px 16px;
  border-radius: var(--radius-card);
  color: var(--ink);
  text-decoration: none;
}
.list-row:hover { background: var(--surface-mint); }

/* ---------- Avatar ---------- */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-mint-2);
  color: var(--green-800);
  font-family: var(--font-heading);
  font-size: 18px;
  line-height: 26px;
  font-weight: 700;
}

/* ---------- Qualiopi badge (navy: only here) ---------- */
.badge-qualiopi { color: var(--navy); }

/* ---------- Utilities ---------- */
.text-muted { color: var(--ink-muted); }
.text-center { text-align: center; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
