/* =============================================================================
   base.css — Modern reset + element defaults
   -----------------------------------------------------------------------------
   A light, modern reset followed by sensible element defaults. Uses ONLY the
   custom properties defined in tokens.css for colors, spacing, radii and type.
   Loaded after tokens.css and before layout/components.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* -----------------------------------------------------------------------------
   Typography defaults
   --------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }
h5,
h6 { font-size: var(--text-sm); }

p {
  line-height: var(--line-height-base);
  text-wrap: pretty;
}

small {
  font-size: var(--text-sm);
}

strong,
b {
  font-weight: var(--font-weight-semibold);
}

/* -----------------------------------------------------------------------------
   Links
   --------------------------------------------------------------------------- */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

a:active {
  color: var(--color-primary-hover);
}

/* -----------------------------------------------------------------------------
   Media
   --------------------------------------------------------------------------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* -----------------------------------------------------------------------------
   Lists — reset only where the .list utility / nav are used; default lists in
   prose keep their markers via an opt-out below.
   --------------------------------------------------------------------------- */
ul,
ol {
  list-style: none;
  padding: 0;
}

/* Restore markers for plain prose lists that opt in. */
ul.prose-list,
ol.prose-list {
  list-style: revert;
  padding-left: var(--space-5);
}

/* -----------------------------------------------------------------------------
   Form controls — inherit font, normalize appearance
   --------------------------------------------------------------------------- */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

button:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

/* Remove default number-input spinners for a cleaner look */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* -----------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */
table {
  border-collapse: collapse;
  width: 100%;
}

/* -----------------------------------------------------------------------------
   Accessible focus — visible ring for keyboard users only
   --------------------------------------------------------------------------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Remove the lingering outline for mouse users who don't get :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

/* -----------------------------------------------------------------------------
   Selection
   --------------------------------------------------------------------------- */
::selection {
  background-color: var(--color-primary-soft);
  color: var(--color-text);
}

/* -----------------------------------------------------------------------------
   Reduced motion — honor user preference
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
