/**
 * Andgreen primitives — depends on foundations/tokens.css
 */

/* ── Typography helpers ── */
.ag-break-keep {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.ag-title-1 {
  font-size: var(--ag-text-4xl);
  font-weight: var(--ag-weight-bold);
  line-height: var(--ag-leading-tight);
  letter-spacing: -0.02em;
  color: var(--ag-fg);
}

.ag-title-2 {
  font-size: var(--ag-text-2xl);
  font-weight: var(--ag-weight-semibold);
  line-height: var(--ag-leading-tight);
  color: var(--ag-fg);
}

.ag-title-3 {
  font-size: var(--ag-text-xl);
  font-weight: var(--ag-weight-semibold);
  color: var(--ag-fg);
}

.ag-body {
  font-size: var(--ag-text-md);
  color: var(--ag-fg);
}

.ag-muted {
  font-size: var(--ag-text-sm);
  color: var(--ag-fg-muted);
}

/* ── Button ── */
.ag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ag-space-2);
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--ag-radius-full);
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--ag-text-sm);
  font-weight: var(--ag-weight-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  background: var(--ag-primary);
  color: var(--ag-primary-fg);
  box-shadow: var(--ag-shadow-sm);
  transition:
    background var(--ag-duration) var(--ag-ease),
    transform var(--ag-duration) var(--ag-ease),
    box-shadow var(--ag-duration) var(--ag-ease);
}

.ag-btn:hover {
  background: var(--ag-primary-hover);
  box-shadow: var(--ag-shadow);
}

.ag-btn:active {
  background: var(--ag-primary-active);
  transform: translateY(1px);
}

.ag-btn:focus-visible {
  outline: none;
  box-shadow: var(--ag-ring);
}

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

.ag-btn-ghost {
  background: transparent;
  color: var(--ag-primary);
  border-color: var(--ag-border-strong);
  box-shadow: none;
}

.ag-btn-ghost:hover {
  background: var(--ag-primary-soft);
}

.ag-btn-secondary {
  background: var(--ag-surface);
  color: var(--ag-fg);
  border-color: var(--ag-border-strong);
  box-shadow: var(--ag-shadow-sm);
}

.ag-btn-secondary:hover {
  background: var(--ag-surface-2);
}

/* ── Chip / Badge ── */
.ag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--ag-space-1);
  padding: 0.2rem 0.65rem;
  border-radius: var(--ag-radius-full);
  font-size: var(--ag-text-xs);
  font-weight: var(--ag-weight-semibold);
  background: var(--ag-primary-soft);
  color: var(--ag-primary-hover);
}

.ag-chip-success {
  background: var(--ag-success-soft);
  color: var(--ag-success);
}

.ag-chip-warn {
  background: var(--ag-warn-soft);
  color: oklch(0.45 0.1 85);
}

.ag-chip-danger {
  background: var(--ag-danger-soft);
  color: var(--ag-danger);
}

/* ── Input ── */
.ag-input,
.ag-textarea,
.ag-select {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--ag-border-strong);
  border-radius: var(--ag-radius);
  background: var(--ag-surface);
  color: var(--ag-fg);
  font: inherit;
  font-size: var(--ag-text-md);
  transition: border-color var(--ag-duration) var(--ag-ease),
    box-shadow var(--ag-duration) var(--ag-ease);
}

.ag-textarea {
  min-height: 120px;
  resize: vertical;
}

.ag-input:focus-visible,
.ag-textarea:focus-visible,
.ag-select:focus-visible {
  outline: none;
  border-color: var(--ag-primary);
  box-shadow: var(--ag-ring);
}

.ag-label {
  display: block;
  margin-bottom: var(--ag-space-2);
  font-size: var(--ag-text-sm);
  font-weight: var(--ag-weight-medium);
  color: var(--ag-fg);
}

/* ── Alert ── */
.ag-alert {
  padding: var(--ag-space-3) var(--ag-space-4);
  border-radius: var(--ag-radius);
  border: 1px solid var(--ag-border);
  font-size: var(--ag-text-sm);
  line-height: var(--ag-leading);
}

.ag-alert-error {
  background: var(--ag-danger-soft);
  border-color: oklch(0.85 0.05 25);
  color: var(--ag-danger);
}

.ag-alert-info {
  background: var(--ag-info-soft);
  border-color: oklch(0.85 0.04 230);
  color: var(--ag-info);
}

.ag-alert-success {
  background: var(--ag-success-soft);
  border-color: oklch(0.85 0.04 150);
  color: var(--ag-success);
}

/* ── Empty ── */
.ag-empty {
  text-align: center;
  padding: var(--ag-space-7) var(--ag-space-5);
  border: 1px dashed var(--ag-border-strong);
  border-radius: var(--ag-radius-lg);
  background: var(--ag-surface-2);
  color: var(--ag-fg-muted);
}

.ag-empty strong {
  display: block;
  color: var(--ag-fg);
  font-size: var(--ag-text-lg);
  font-weight: var(--ag-weight-semibold);
  margin-bottom: var(--ag-space-2);
}

.ag-empty p {
  margin: 0 0 var(--ag-space-4);
  font-size: var(--ag-text-sm);
  max-width: 28rem;
  margin-inline: auto;
}

/* ── Card ── */
.ag-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-lg);
  box-shadow: var(--ag-shadow-sm);
  padding: var(--ag-space-5);
}

/* ── Steps ── */
.ag-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--ag-space-3);
}

@media (max-width: 640px) {
  .ag-steps {
    grid-template-columns: 1fr;
  }
}

.ag-step {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: var(--ag-space-4);
  box-shadow: var(--ag-shadow-sm);
}

.ag-step-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--ag-radius-full);
  background: var(--ag-primary);
  color: var(--ag-primary-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ag-text-sm);
  font-weight: var(--ag-weight-bold);
  margin-bottom: var(--ag-space-2);
}

.ag-step h3 {
  font-size: var(--ag-text-sm);
  font-weight: var(--ag-weight-semibold);
  margin: 0 0 var(--ag-space-1);
  color: var(--ag-fg);
}

.ag-step p {
  margin: 0;
  font-size: var(--ag-text-xs);
  color: var(--ag-fg-muted);
  line-height: var(--ag-leading);
}

/* ── Spinner ── */
.ag-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--ag-border-strong);
  border-top-color: var(--ag-primary);
  border-radius: 50%;
  animation: ag-spin 0.7s linear infinite;
}

@keyframes ag-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-spinner {
    animation: none;
    border-top-color: var(--ag-primary);
    opacity: 0.7;
  }
}
