/* Reset + typography + form-element foundations. */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Money/count number inputs: no step (up/down) spinners anywhere. Values
   are typed (and clamped) instead. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Keyboard users land here first; hidden until it receives focus. */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.5rem 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--foreground);
  text-wrap: balance;
}

p {
  line-height: 1.6;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

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

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

::selection {
  background: var(--accent);
  color: var(--accent-foreground);
}

.icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: no-preference) {
  button,
  .btn,
  .sidebar-link,
  .tab {
    transition: transform var(--dur-med) var(--ease-out-soft),
      background-color var(--dur-fast) ease-out,
      border-color var(--dur-fast) ease-out,
      box-shadow var(--dur-med) var(--ease-out-soft),
      color var(--dur-fast) ease-out;
  }

  button:active {
    transform: scale(0.97);
  }

  /* Nested icon circles inside primary CTAs: internal kinetic tension. */
  .btn .icon {
    display: grid;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 999px;
    background: color-mix(in oklch, currentColor 14%, transparent);
    transition: transform var(--dur-med) var(--ease-spring);
  }

  /* Icon-only buttons (toolbar CSV/PDF exports): the glyph IS the button -
     no kinetic circle chip, and the glyph centers in the button. */
  .btn:not(:has(> :not(.icon))) .icon {
    margin: 0;
    background: none;
  }

  .btn:not(:has(> :not(.icon))):hover .icon,
  .btn:not(:has(> :not(.icon))):focus-visible .icon {
    transform: none;
  }

  .btn:hover .icon,
  .btn:focus-visible .icon {
    transform: translate(1px, -1px) scale(1.06);
  }

  .btn-primary .icon {
    background: rgba(255, 255, 255, 0.16);
  }

  /* Entry choreography: [data-reveal] is only ever set by js/lib/reveal.js,
     which is a no-op under reduced motion - so this stays scoped. */
  [data-reveal] {
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity var(--dur-slow) var(--ease-out-soft),
      transform var(--dur-slow) var(--ease-out-soft);
    transition-delay: var(--reveal-delay, 0ms);
  }

  [data-reveal].revealed {
    opacity: 1;
    transform: none;
  }
}
