/* ────────────────────────────────────────────────────────
   base.css — reset + body + typography + a11y
   Loaded after tokens.css so the body uses the active theme.
   ──────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html {
  height: 100%;
  overscroll-behavior-y: contain;        /* No browser pull-to-refresh */
}
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-snug);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  position: relative;
  isolation: isolate;
  /* Mesh background (style-mix) sits at z-index:0 — pull content above. */
  z-index: 1;
}

#root {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--sp-16) var(--sp-16);
  padding-top:    calc(var(--sp-12) + var(--safe-top));
  padding-bottom: calc(var(--sp-32) + 80px + var(--safe-bottom));
  min-height: 100dvh;
}

/* Typography helpers */
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); }

a, button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* Scrollbars — ghosted by default, visible on hover/scroll */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 999px;
}

/* Selection */
::selection {
  background: rgba(var(--accent-primary-rgb), 0.4);
  color: var(--text-primary);
}

/* Focus visible — keyboard users only */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* A11y skip text */
.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;
}

/* ── Universal motion primitives ─────────────────────── */
.tappable {
  transition: transform var(--dur-fast) var(--ease-spring);
  -webkit-touch-callout: none;
  user-select: none;
}
.tappable:active {
  transform: scale(0.96);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.skeleton {
  background: linear-gradient(90deg,
              var(--glass-bg) 25%,
              var(--glass-bg-strong) 50%,
              var(--glass-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-small);
  color: transparent;
}

/* Reduce motion if the user asks for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
