/**
 * Rally - Base styles: resets, page scaffolding, accessibility utilities.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--app-bg);
  transition: background-color var(--transition-mode);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(var(--space-sm), env(safe-area-inset-top))
    max(var(--space-md), env(safe-area-inset-right))
    max(var(--space-lg), env(safe-area-inset-bottom))
    max(var(--space-md), env(safe-area-inset-left));
  background-color: var(--app-bg);
  background-image: radial-gradient(ellipse 70% 45% at 50% -5%, var(--theme-tint), transparent 70%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color var(--transition-mode);
}

h1, h2, h3 {
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

input,
select {
  background: transparent;
  border: none;
}

ul {
  list-style: none;
}

svg {
  display: block;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

.numeric-tabular {
  font-variant-numeric: tabular-nums;
}

/* Focus: a clear ring for keyboard users, nothing for mouse/touch. */
:focus {
  outline: none;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100px;
  z-index: 100;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--theme-accent);
  color: var(--on-accent);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-sm);
}

kbd {
  font-family: inherit;
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--surface-border-strong);
  background: var(--surface-subtle);
}
