/* ScoreEntreprise design system — "le dossier", calm daylight variant.
   Warm sable/cream registry backdrop, white paper dossier cards, sauge
   accent, grade-driven color language, and an ink-stamp verdict badge as
   the signature motif. A couple of panels (API code sample, API key box)
   stay deliberately dark for contrast/legibility, using the panel-dark-* set. */

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

:root {
  /* Calm neutral surface system */
  --bg: #F3EFE6;           /* page background — sable creme */
  --bg-alt: #EBE3CD;       /* alternating section band */
  --surface: #FFFEFA;      /* card / paper surface — blanc casse */
  --surface-dim: #F1EADA;  /* secondary/nested surface on cards */
  --line: #E3DAC2;         /* hairline border on light surfaces */

  --text: #2B2A25;         /* anthracite chaud — primary text */
  --text-dim: #6B6558;     /* muted secondary text */
  --text-faint: #9A937E;   /* faintest labels */

  /* Accent — sauge mat */
  --accent: #6B8F71;
  --accent-dim: #4F6B54;
  --accent-glow: rgba(107, 143, 113, 0.28);
  --gold: #C9A45C;

  /* Deliberately dark contrast panels (API code sample, API key box) */
  --panel-dark: #24281F;
  --panel-dark-line: #3A3F32;
  --panel-dark-text: #D8D2BE;
  --panel-dark-text-dim: #8C9082;

  /* Grade semantics — reused everywhere a verdict appears */
  --grade-a: #4C7A52;
  --grade-b: #7C8F4E;
  --grade-c: #B9852B;
  --grade-d: #BD5B2B;
  --grade-f: #A33F3F;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-paper: 0 20px 50px -24px rgba(43, 42, 37, 0.16), 0 2px 10px rgba(43, 42, 37, 0.08);
  --shadow-soft: 0 10px 28px -16px rgba(43, 42, 37, 0.12);

  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-dim);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* --- Grade color binding: apply .grade-a..f to set --gc on any component --- */
.grade-a { --gc: var(--grade-a); }
.grade-b { --gc: var(--grade-b); }
.grade-c { --gc: var(--grade-c); }
.grade-d, .grade-f { --gc: var(--grade-f); }
.grade-d { --gc: var(--grade-d); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #FBFDF8;
  box-shadow: 0 8px 22px -8px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost-dark,
.btn-ghost-paper {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.btn-ghost-dark:hover,
.btn-ghost-paper:hover { color: var(--text); background: var(--surface-dim); border-color: var(--text-faint); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* --- Paper dossier card --- */
.paper {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
  position: relative;
}
.paper::before {
  /* faint ruled hairline at the top, like a ledger page edge */
  content: '';
  position: absolute;
  top: 14px; left: 22px; right: 22px;
  height: 1px;
  background: var(--line);
}

/* --- Verdict stamp: the signature element --- */
.stamp-ring {
  --pct: 0;
  --gc: var(--grade-c);
  position: relative;
  width: 132px; height: 132px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stamp-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--gc) calc(var(--pct) * 1%), var(--line) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  transition: background 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.stamp {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 3px solid var(--gc);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--gc) 16%, transparent);
  background: color-mix(in srgb, var(--gc) 6%, var(--surface));
  color: var(--gc);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-4deg);
}
.stamp .stamp-grade {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.stamp .stamp-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

/* Compact stamp variant for inline/dashboard use */
.stamp-ring.sm { width: 88px; height: 88px; }
.stamp-ring.sm .stamp { inset: 8px; }
.stamp-ring.sm .stamp .stamp-grade { font-size: 22px; }
.stamp-ring.sm .stamp .stamp-num { font-size: 9px; }

/* --- Ledger row (signal breakdown) --- */
.ledger-row {
  display: grid;
  grid-template-columns: 1fr auto 96px;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  opacity: 0;
  animation: ledgerIn 0.4s ease forwards;
}
.ledger-row:last-child { border-bottom: none; }
.ledger-name { color: var(--text); font-weight: 600; }
.ledger-source {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 1px;
}
.ledger-score {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gc, var(--text));
  text-align: right;
}
.ledger-bar-bg {
  height: 6px;
  border-radius: 100px;
  background: var(--surface-dim);
  overflow: hidden;
}
.ledger-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--gc, var(--accent));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ledgerIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ledger-row:nth-child(1) { animation-delay: 0.02s; }
.ledger-row:nth-child(2) { animation-delay: 0.06s; }
.ledger-row:nth-child(3) { animation-delay: 0.10s; }
.ledger-row:nth-child(4) { animation-delay: 0.14s; }
.ledger-row:nth-child(5) { animation-delay: 0.18s; }
.ledger-row:nth-child(6) { animation-delay: 0.22s; }
.ledger-row:nth-child(7) { animation-delay: 0.26s; }
.ledger-row:nth-child(8) { animation-delay: 0.30s; }
.ledger-row:nth-child(9) { animation-delay: 0.34s; }
.ledger-row:nth-child(10) { animation-delay: 0.38s; }
.ledger-row:nth-child(11) { animation-delay: 0.42s; }
.ledger-row:nth-child(12) { animation-delay: 0.46s; }
.ledger-row:nth-child(13) { animation-delay: 0.50s; }
.ledger-row:nth-child(14) { animation-delay: 0.54s; }

/* --- Form elements --- */
.field {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.field::placeholder { color: var(--text-faint); }

/* --- Scroll-reveal (used on landing sections + dashboard cards) --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

.stats-row .reveal:nth-child(1) { transition-delay: 0.02s; }
.stats-row .reveal:nth-child(2) { transition-delay: 0.08s; }
.stats-row .reveal:nth-child(3) { transition-delay: 0.14s; }
.stats-row .reveal:nth-child(4) { transition-delay: 0.20s; }
.grid-2 .reveal:nth-child(1) { transition-delay: 0.06s; }
.grid-2 .reveal:nth-child(2) { transition-delay: 0.12s; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* --- Focus visibility --- */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
