/* Olocus base reset + typography defaults.
 *
 * Lightweight reset (no Tailwind preflight — Olocus uses class constants,
 * not utility classes) + the brand type scale wired to the tokens in
 * tokens.css. Component CSS adds layout on top of this baseline. */

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mobile-first viewport baseline (qub pattern).
 *
 * Safari iOS auto-inflates root font-size on text-heavy pages via its
 * Text Inflation Algorithm; iOS PWA standalone disables that algorithm,
 * so the same CSS renders smaller in PWA mode. Bumping the base size at
 * narrow viewports makes PWA match what users see in mobile Safari,
 * without affecting desktop. ~17px ≈ 1.0625rem. */
@media (max-width: 640px) {
  html {
    font-size: 1.0625rem;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  /* Respect the iOS notch + Android gesture bar so chrome doesn't sit
   * under the system UI. Per-surface chrome (shell toolbar, drawer)
   * adds its own safe-area additions on top of this baseline. */
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background-color: var(--color-bg-page);
  color: var(--color-text-body);
  /* Kill iOS Safari's grey flash on tap; the visible state changes are
   * carried by :active / :focus-visible per the component contracts. */
  -webkit-tap-highlight-color: transparent;
}

/* Fallback for browsers without small-viewport units. Older Safari +
 * Firefox < 101 fall back to 100vh; the `dvh` unit gives the rest a
 * stable height that excludes mobile UI chrome. */
@supports not (min-height: 100dvh) {
  body {
    min-height: 100vh;
  }
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--color-text-heading);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--color-primary-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--color-primary-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button {
  font: inherit;
  color: inherit;
}

@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;
  }
}
