/* RematesDB shared components.
 *
 * The parts more than one surface needs: the customer portal and the
 * public apex both render buttons, data tables, code blocks, scope
 * chips and status panels. A surface adds its own layout rules on
 * top of these; anything that grows a second implementation belongs
 * here instead.
 *
 * Consumes ``design/tokens.css``; never declares a raw colour,
 * radius or space of its own.
 */

:root {
  color-scheme: light;
}

/* Focus ------------------------------------------------------------ */

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

/* Buttons ---------------------------------------------------------- */

.ds-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out,
    color 120ms ease-out;
}

.ds-button--primary {
  background: var(--color-ink);
  color: var(--color-text-inverse);
}

.ds-button--primary:hover {
  background: var(--color-accent-strong);
}

.ds-button--secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.ds-button--secondary:hover {
  border-color: var(--color-ink);
}

.ds-button:disabled {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-text-faint);
  cursor: not-allowed;
}

/* Panels ----------------------------------------------------------- */

.ds-panel {
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.ds-panel--flush {
  padding: 0;
}

.ds-panel--status {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.ds-panel--alert {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

/* Data tables ------------------------------------------------------ */

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ds-table caption {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: left;
}

.ds-table th {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.ds-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.ds-table tbody tr:last-child td {
  border-bottom: 0;
}

.ds-table td.num,
.ds-table th.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Code blocks & Terminals ------------------------------------------ */

.ds-code-window {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid #21262d;
  background: var(--color-ink);
  box-shadow: var(--shadow);
  margin: var(--space-4) 0;
}

.ds-code-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: #161b22;
  border-bottom: 1px solid #21262d;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
}

.ds-code-window-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ds-code-window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.ds-code-window-dot--red { background: #ff5f56; }
.ds-code-window-dot--yellow { background: #ffbd2e; }
.ds-code-window-dot--green { background: #27c93f; }

.ds-code-window-title {
  color: #8b949e;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.ds-code {
  overflow-x: auto;
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--color-ink);
  color: var(--color-text-inverse);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  tab-size: 2;
  border: 1px solid #21262d;
}

.ds-code-window .ds-code {
  border: none;
  border-radius: 0;
}

.ds-code code {
  font-family: inherit;
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  font-size: inherit;
}

/* Scope chips ------------------------------------------------------ */

.ds-chip {
  display: inline-block;
  padding: 1px var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* Method badges ---------------------------------------------------- */

.ds-method {
  display: inline-block;
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

.ds-method--get {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  border: 1px solid var(--color-border);
}

.ds-method--post {
  background: var(--color-surface-muted);
  color: var(--color-ink);
  border: 1px solid var(--color-border-strong);
}

.ds-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-weight: 800;
  font-size: var(--text-xs);
}

/* Status marks ----------------------------------------------------- */

.ds-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ds-status::before {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.ds-status--live {
  color: var(--color-accent-strong);
}

.ds-status--muted {
  color: var(--color-text-faint);
}

.ds-status--danger {
  color: var(--color-danger);
}

/* Definition rows --------------------------------------------------- */

.ds-definitions {
  margin: 0;
}

.ds-definitions dt {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ds-definitions dd {
  margin: 0 0 var(--space-3);
  font-variant-numeric: tabular-nums;
}

/* Reduced motion --------------------------------------------------- */

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

