/* ─────────────────────────────────────────────────────────────
   Cotrugli — Components
   Token-driven, framework-free recreations of the kit primitives.
   Each block maps 1:1 to a component in the design bundle's
   primitives.jsx, so it can become a Phoenix function component later.
   ───────────────────────────────────────────────────────────── */

/* ── Icon — Tabler outline, inherits color, 1.5 stroke (see sprite) ── */
.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon--12 { width: 12px; height: 12px; }
.icon--14 { width: 14px; height: 14px; }
.icon--16 { width: 16px; height: 16px; }
.icon--20 { width: 20px; height: 20px; }
.icon--24 { width: 24px; height: 24px; }
.icon--32 { width: 32px; height: 32px; }

/* ── Mark — outlined square + signal "C" ── */
.mark {
  --mk-size: 28px; --mk-font: 15px; --mk-border: 1px;
  width: var(--mk-size); height: var(--mk-size);
  border: var(--mk-border) solid var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--mk-font); font-weight: 500;
  color: var(--signal); line-height: 1; flex-shrink: 0;
}
.mark--26 { --mk-size: 26px; --mk-font: 14px; --mk-border: 1px; }
.mark--36 { --mk-size: 36px; --mk-font: 20px; --mk-border: 1.2px; }

/* ── Wordmark — "Cotrugli" with the custom signal-dot i (em-scaled) ── */
.wordmark {
  font-family: var(--font-sans); font-weight: 500; font-size: 18px;
  letter-spacing: -0.025em; color: var(--text); line-height: 1;
  display: inline-flex; align-items: baseline;
}
.wordmark__i { position: relative; display: inline-block; width: 0.26em; height: 0.73em; margin-left: 0.015em; }
.wordmark__stem { position: absolute; bottom: 0; left: 50%; width: 0.11em; height: 0.516em; background: currentColor; transform: translateX(-50%); }
.wordmark__dot  { position: absolute; top: 0;    left: 50%; width: 0.11em; height: 0.11em;  background: var(--signal); transform: translateX(-50%); }

/* ── Lockup — mark + wordmark (chrome; never underlined) ── */
.lockup { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }

/* ── Button — five flavors, tokenized; linear hover only ── */
.btn {
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--r-2); border: 1px solid transparent;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background-color var(--t-base) var(--easing),
              border-color var(--t-base) var(--easing),
              color var(--t-base) var(--easing);
}
.btn--lg { font-size: 14px; padding: 10px 18px; }   /* marketing scale */

.btn--primary   { background: var(--text); color: var(--surface); }
.btn--primary:hover   { background: var(--text-muted); }
.btn--secondary { background: transparent; border-color: var(--surface-rule); color: var(--text); }
.btn--secondary:hover { border-color: var(--text-subtle); }
.btn--ghost     { background: transparent; border-color: var(--surface-rule); color: var(--text-muted); }
.btn--ghost:hover     { background: var(--surface-elev); color: var(--text); }
.btn--danger    { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover    { background: var(--surface-elev); }
.btn--agent     { background: var(--signal); color: var(--signal-ink); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; }
.btn--agent:hover     { background: var(--signal-soft); }

/* ── Badge — agent + four states + neutral ── */
.badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  padding: 3px 7px; border-radius: var(--r-1); display: inline-flex;
  align-items: center; gap: 6px; text-transform: uppercase; line-height: 1.4;
  border: 1px solid transparent;
}
.badge__dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.badge--agent   { background: var(--signal); color: var(--signal-ink); }
.badge--agent .badge__dot { background: var(--signal-ink); }
.badge--success { background: var(--surface-elev); color: var(--success); border-color: var(--surface-rule); }
.badge--warning { background: var(--surface-elev); color: var(--warning); border-color: var(--surface-rule); }
.badge--danger  { background: var(--surface-elev); color: var(--danger);  border-color: var(--surface-rule); }
.badge--info    { background: var(--surface-elev); color: var(--info);    border-color: var(--surface-rule); }
.badge--neutral { background: var(--surface);      color: var(--text-muted); border-color: var(--surface-rule); }

/* ── Pill — marketing tag (signal outline / neutral outline) ── */
.pill {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  padding: 3px 8px; border-radius: var(--r-1); text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.4;
  border: 1px solid transparent;
}
.pill--signal  { color: var(--signal); border-color: var(--signal); }
.pill--neutral { color: var(--text-subtle); border-color: var(--surface-rule); }

/* ── Section tag — "§ 01 — label", mono, signal (agentic context) ── */
.section-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em;
  color: var(--signal); text-transform: uppercase; margin-bottom: 12px;
}

/* ── Stat — big mono number + label (tiles) ── */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-subtle); }
.stat__value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat__sub   { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* ── Cards — borders, not boxes. No shadows, anywhere. ── */
.card          { background: var(--surface-elev); border: 1px solid var(--surface-rule); border-radius: var(--r-3); }
.card--elevated{ background: var(--surface); border: 1px solid var(--text-faint); }
.card--accent  { border-left: 2px solid var(--signal); border-radius: 0 var(--r-3) var(--r-3) 0; }  /* agent content only */

/* ── Data table — the signature surface ── */
.data-table { width: 100%; font-size: 13px; }
.data-table th {
  text-align: left; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; color: var(--text-subtle); text-transform: uppercase;
  padding: 10px 14px; border-bottom: 1px solid var(--surface-rule); font-weight: 500;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--surface-rule); color: var(--text); vertical-align: middle; }
.data-table--flush tbody tr:last-child td { border-bottom: none; }   /* BAS / numbers tables drop the final rule */
.data-table .num   { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono  { font-family: var(--font-mono); }
.data-table .muted { color: var(--text-muted); }
.col-right { text-align: right; }

/* Reconciliation row hover — quiet, one step back, no color (README §hover). */
.data-table--rows tbody tr { transition: background-color var(--t-quick) var(--easing); }
.data-table--rows tbody tr:hover { background: var(--surface); }

/* ── Match cell (reconcile) — badge + mono confidence ── */
.match { display: inline-flex; align-items: center; gap: 8px; }
.match__conf { color: var(--text-subtle); font-family: var(--font-mono); font-size: 11px; }

/* ── Confidence bar (exceptions) ── */
.confbar { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.confbar__track { flex: 1; height: 4px; background: var(--surface-rule); border-radius: 1px; overflow: hidden; }
.confbar__fill  { height: 100%; }
.confbar__fill--high { background: var(--signal); }
.confbar__fill--mid  { background: var(--warning); }
.confbar__fill--low  { background: var(--danger); }
.confbar__pct { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }

/* ── Theme toggle button (shared chrome) ── */
.theme-toggle {
  background: none; border: 1px solid var(--surface-rule); border-radius: var(--r-2);
  padding: 6px 10px; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  transition: border-color var(--t-base) var(--easing), color var(--t-base) var(--easing);
}
.theme-toggle:hover { border-color: var(--text-subtle); color: var(--text); }
/* Show the correct word + icon per theme (set by .light on <html>). */
.theme-toggle__dark, .theme-toggle__light { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle__light { display: none; }
.light .theme-toggle__light { display: inline-flex; }
.light .theme-toggle__dark  { display: none; }
