/* base.css — resets, element defaults, and small shared utilities. */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-med) var(--ease),
    color var(--dur-med) var(--ease);
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  cursor: pointer;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* Screen-reader-only helper. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-boot {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--text-muted);
  font-size: var(--fs-lg);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: 1;
  background: var(--bg-surface);
  color: var(--text-strong);
  border-color: var(--border-strong);
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover {
  background: var(--bg-hover);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
}
.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--bg-hover);
}
.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-sm);
}
.btn-icon {
  padding: var(--sp-2);
  border-radius: var(--radius-md);
}

/* ---- Generic helpers ---- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.spacer {
  flex: 1 1 auto;
}
.text-muted {
  color: var(--text-muted);
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
