/* ============================================================================
 * site.css — design tokens + base components shared by every static page.
 *
 * Loaded BEFORE any page-specific CSS so all pages start from the same
 * variables and primitives. Page-specific stylesheets only add what they
 * need on top — no overrides of the palette.
 * ==========================================================================*/

:root {
  /* Brand palette — Haitian flag inspired. Stays identical on every page. */
  --primary: #0b6b3a;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-700: #075f33;
  --accent: #d62828;

  /* Neutral surfaces */
  --bg: #fafaf9;
  --bg-soft: #f5f5f4;
  --card: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  /* Text */
  --text: #1c1917;
  --muted: #57534e;
  --muted-2: #78716c;

  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #2563eb;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  color-scheme: light;
}

/* ============== Reset / base ============== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
code, pre {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
a { color: inherit; text-decoration: none; }

/* ============== Layout ============== */

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ============== Site header (shared nav) ============== */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 250, 249, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.site-header.scrolled {
  background: rgba(255, 255, 255, .92);
  border-bottom-color: var(--border);
}
.site-header-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--text);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  position: relative;
}
.brand-mark::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); position: absolute; top: -2px; right: -2px;
  box-shadow: 0 0 0 2px var(--bg);
}

.site-nav { display: none; gap: 4px; }
@media (min-width: 880px) { .site-nav { display: flex; } }
.site-nav a {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: rgba(0, 0, 0, .04); }
.site-nav a.active { color: var(--primary); background: var(--primary-50); }

.site-cta { display: flex; gap: 8px; align-items: center; }

/* Burger (mobile) */
.burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}
@media (min-width: 880px) { .burger { display: none; } }

.mobile-menu {
  display: none; padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: #fff;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text);
}
.mobile-menu a:hover { background: var(--bg-soft); }

/* ============== Buttons ============== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s,
              color .12s, border-color .12s;
  font-family: inherit; line-height: 1;
}
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(11, 107, 58, .25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-700); transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 107, 58, .32);
}

.btn-ghost {
  color: var(--text); border-color: var(--border); background: #fff;
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong); background: var(--bg-soft);
}

.btn-danger {
  background: var(--danger); color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .25);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; transform: translateY(-1px); }

.btn-link {
  height: auto; padding: 0; background: transparent;
  color: var(--primary); text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ============== Form controls ============== */

label.field-label {
  font-size: 13px; font-weight: 600; color: var(--muted);
  display: block; margin-bottom: 6px;
}

.input,
.textarea,
.select {
  width: 100%; padding: 10px 12px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: #fff;
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 107, 58, .12);
}

.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%23737373' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  background-size: 12px 8px;
}

.checkbox {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer; vertical-align: middle;
}

.field-row {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}

.field-help {
  font-size: 12px; color: var(--muted); margin-top: 4px;
}

/* ============== Cards ============== */

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.card-lg { padding: 28px; border-radius: var(--radius-lg); }

/* ============== Badges / pills ============== */

.eyebrow {
  display: inline-block; padding: 4px 12px;
  background: var(--primary-50); color: var(--primary);
  border-radius: 999px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border);
}
.badge-ok { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.badge-warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-err { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.badge-info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge-muted { background: #f5f5f4; color: var(--muted); border-color: var(--border); }

/* ============== Verification stepper (shared by /test + dashboard) ============== */

.verify-stepper { display: flex; justify-content: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.verify-stepper-dot { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.verify-stepper-dot .num {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 2px solid var(--border);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--muted);
  transition: all .2s;
}
.verify-stepper-dot.active .num { background: var(--primary); border-color: var(--primary); color: #fff; }
.verify-stepper-dot.done .num { background: var(--success); border-color: var(--success); color: #fff; }
.verify-stepper-dot.active, .verify-stepper-dot.done { color: var(--text); font-weight: 600; }

.verify-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  max-width: 560px; margin: 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.verify-card h2 { font-size: 20px; margin: 0 0 6px; }
.verify-card .lede { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.verify-card.hidden { display: none; }

.verify-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer; display: block;
}
.verify-zone:hover, .verify-zone.dragover { border-color: var(--primary); background: var(--primary-50); }
.verify-zone svg { color: var(--muted); margin: 0 auto 10px; display: block; }
.verify-zone strong { display: block; color: var(--text); margin-bottom: 4px; }
.verify-zone span { font-size: 13px; color: var(--muted); }
.verify-zone input[type="file"] { display: none; }

.verify-preview {
  margin-top: 14px; padding: 12px;
  background: var(--bg-soft); border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px;
}
.verify-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.verify-preview-info { flex: 1; min-width: 0; }
.verify-preview-info strong { display: block; font-size: 14px; }
.verify-preview-info span { font-size: 12px; color: var(--muted); }
.verify-preview button { background: transparent; border: none; color: var(--danger); cursor: pointer; padding: 4px 8px; font-size: 16px; }

.verify-step-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: space-between; }
.verify-step-actions.right { justify-content: flex-end; }

.verify-spinner-block { text-align: center; padding: 32px 20px; }
.verify-spinner {
  width: 44px; height: 44px; margin: 0 auto 14px;
  border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%;
  animation: verify-spin 1s linear infinite;
}
@keyframes verify-spin { to { transform: rotate(360deg); } }

.verify-result { text-align: center; padding: 20px; }
.verify-result-ico {
  width: 64px; height: 64px; margin: 0 auto 12px;
  border-radius: 50%; display: grid; place-items: center;
}
.verify-result.ok .verify-result-ico { background: var(--primary-50); color: var(--primary); }
.verify-result.bad .verify-result-ico { background: #fee2e2; color: var(--danger); }
.verify-result.review .verify-result-ico { background: #fef3c7; color: #b45309; }
.verify-result h2 { margin: 0 0 6px; }
.verify-result .lede { color: var(--muted); margin: 0 0 16px; }
.verify-fields {
  background: var(--bg-soft); border-radius: var(--radius);
  padding: 14px 18px; text-align: left; max-width: 340px; margin: 0 auto 18px;
}
.verify-fields dl { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.verify-fields dt { color: var(--muted); }
.verify-fields dd { margin: 0; font-weight: 600; }

.verify-err {
  margin-top: 12px; padding: 10px 12px;
  background: #fee2e2; color: #991b1b;
  border: 1px solid #fecaca; border-radius: var(--radius-sm);
  font-size: 13px;
}
.verify-err[hidden] { display: none; }

/* ============== Charts (shared) ============== */

.idm-chart-host { width: 100%; }
.idm-chart-host svg { display: block; width: 100%; }

.idm-donut-wrap {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
}
.idm-donut-wrap > svg { flex-shrink: 0; }

.idm-donut-legend {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
  font-size: 13px; min-width: 180px; flex: 1;
}
.idm-donut-legend li {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 10px;
  align-items: center;
}
.idm-donut-dot {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block;
}
.idm-donut-name { color: var(--text); }
.idm-donut-val { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

.chart-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
}
.chart-card h3 {
  font-size: 13px; font-weight: 600; margin: 0 0 4px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.chart-card .chart-headline {
  font-size: 24px; font-weight: 700; color: var(--text);
  margin: 0 0 12px; line-height: 1.1;
}
.chart-card .chart-headline small {
  font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px;
}
.chart-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 20px;
}

/* ============== Typography ============== */

h1, h2, h3, h4 {
  letter-spacing: -0.01em; color: var(--text);
}
h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.1; font-weight: 800; }
h2 { font-size: clamp(22px, 3vw, 32px); line-height: 1.18; font-weight: 700; }
h3 { font-size: 18px; line-height: 1.3; font-weight: 700; }
.lede { color: var(--muted); font-size: 17px; line-height: 1.5; }
.muted { color: var(--muted); }

/* ============== Footer (shared, horizontal, responsive) ============== */

.site-footer {
  background: #1c1917; color: #d6d3d1;
  padding: 28px 0 22px;
}
.site-footer-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap;
}
.site-footer .foot-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; color: #fff; font-size: 16px;
  text-decoration: none;
  flex-shrink: 0;
}
.site-footer .foot-brand .brand-mark { background: var(--primary); }
.site-footer .foot-links {
  display: flex; flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  font-size: 13.5px;
}
.site-footer .foot-links a {
  color: #a8a29e; transition: color .15s;
  padding: 4px 0; text-decoration: none;
}
.site-footer .foot-links a:hover { color: #fff; }
.site-footer .foot-bottom {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid #292524;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: #78716c; flex-wrap: wrap; gap: 8px 16px;
}
@media (max-width: 640px) {
  .site-footer-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .site-footer .foot-bottom { flex-direction: column; align-items: flex-start; }
}

/* ============== Reveal-on-scroll (used on every page) ============== */

.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity .8s cubic-bezier(.16, 1, .3, 1),
              transform .8s cubic-bezier(.16, 1, .3, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.delay-1 { transition-delay: .08s; }
.reveal.delay-2 { transition-delay: .16s; }
.reveal.delay-3 { transition-delay: .24s; }
.reveal.delay-4 { transition-delay: .32s; }
.reveal.fade-left { transform: translateX(-30px); }
.reveal.fade-right { transform: translateX(30px); }
.reveal.fade-left.in, .reveal.fade-right.in { transform: translateX(0); }

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

/* ============== Utilities ============== */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
.font-mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }
@media (min-width: 760px) { .md-hidden { display: none !important; } .md-block { display: block !important; } }
