/* Vercel-style components. Tokens come from theme.css. */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--fg); }

/* Basecoat's .btn-outline hovers to the blue --accent; override to the
   neutral grey the rest of the button set uses, matching this theme. */
.btn-outline:hover { background: var(--surface-hover); color: var(--fg); }

.btn-icon { width: 36px; padding: 0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }

/* ---------- input ---------- */
.input {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--fg);
  width: 100%;
  transition: border-color .15s ease;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--fg); }
.input::placeholder { color: var(--fg-3); }

.input-sm { height: 32px; padding: 0 10px; font-size: 13px; }

textarea.input {
  height: auto;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 20px;
  resize: vertical;
}

/* ---------- card / section ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-padded { padding: 20px 24px; }
.card-tight { padding: 14px 16px; }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  height: 36px;
  padding: 3px;
  gap: 2px;
}
.seg > button {
  height: 28px;
  width: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.seg > button:hover { color: var(--fg); }
.seg > button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); }

/* ---------- keyboard hint ---------- */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  background: var(--surface);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.badge-solid { background: var(--fg); color: var(--fg-inverse); border-color: transparent; }

/* ---------- divider ---------- */
.divider { height: 1px; background: var(--border); border: 0; }

/* ---------- link ---------- */
.link { color: var(--fg); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- focus ring (accessibility) ---------- */
.btn:focus-visible,
.input:focus-visible,
.seg > button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- nav item ---------- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  transition: background-color .15s ease, color .15s ease;
  text-decoration: none;
}
.nav-item:hover { background: #eaeaea; color: var(--fg); }
.nav-item[aria-current="page"],
.nav-item.is-active {
  background: #eaeaea;
  color: var(--fg);
}
.nav-item svg { flex-shrink: 0; }
.nav-item .nav-item-chev { margin-left: auto; color: var(--fg-3); }

/* ---------- button label↔spinner swap (HTMX in-flight) ---------- */
/* HTMX adds .htmx-request to the element issuing the request (the <form> for
   form submits, or the button itself for hx-post on a button). These rules
   swap the label↔spinner with no layout shift. */
.htmx-indicator-show { display: none; }
.htmx-request .htmx-indicator-hide { display: none !important; }
.htmx-request .htmx-indicator-show { display: inline-flex !important; align-items: center; gap: 0.5rem; }
