/** Reset, typography, and the primitives every screen reuses. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--bg-3);
  font-size: 11px;
}

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

[hidden] {
  display: none !important;
}

.visuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* -- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), opacity 120ms var(--ease);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--ghost {
  border-color: var(--line);
  background: var(--bg-2);
  color: var(--text-2);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  color: var(--text);
}

.btn--danger {
  border-color: var(--line);
  color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-soft);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}

.iconBtn:hover {
  background: var(--bg-3);
  color: var(--text);
}

.iconBtn--xs {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
}

.pill {
  max-width: 320px;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill:hover {
  color: var(--text-2);
}

/* -- form controls -------------------------------------------------------- */
.control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 120ms var(--ease);
}

.control:hover {
  border-color: var(--line-strong);
}

.control:focus {
  border-color: var(--accent-line);
  outline: none;
}

.control--area {
  min-height: 72px;
  resize: vertical;
  line-height: 1.55;
}

textarea.control {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

::placeholder {
  color: var(--text-3);
}

/* -- toasts --------------------------------------------------------------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 9px;
  align-items: center;
  max-width: 380px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  pointer-events: auto;
  animation: toastIn 180ms var(--ease);
}

.toast[data-tone="success"] { color: var(--ok); }
.toast[data-tone="error"] { color: var(--danger); }

.toast.is-leaving {
  animation: toastOut 160ms var(--ease) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px); }
}

.bootError {
  position: fixed;
  inset: 50% auto auto 50%;
  display: grid;
  gap: 6px;
  padding: 20px 24px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  transform: translate(-50%, -50%);
}

/* -- scrollbars ----------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  background-clip: content-box;
}

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