/* ============================================================================
   Jamlex — Base styles
   ----------------------------------------------------------------------------
   Reset + global typography + dir-aware defaults.
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-family);
  font-size: 16px;
  line-height: var(--lh-normal);
  color: var(--jx-text);
  background: var(--jx-bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Typography ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

h1 { font-size: var(--fs-display-l); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-display-m); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-headline);  font-weight: var(--fw-bold);      line-height: var(--lh-snug); }
h4 { font-size: var(--fs-title);     font-weight: var(--fw-bold);      line-height: var(--lh-snug); }

a {
  color: var(--jx-primary);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-out);
}
a:hover { color: var(--jx-primary-dark); text-decoration: underline; }

/* ── Direction-aware logical defaults ─────────────────────────────────── */
/* Use these via utility classes instead of left/right when writing screens */

/* Reset list bullets where we use lists structurally */
ul, ol { padding: 0; margin: 0; list-style: none; }

/* Default button reset — actual button styles come from components.css */
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
button:focus-visible {
  outline: 2px solid var(--jx-primary);
  outline-offset: 2px;
  border-radius: var(--rd-1);
}

/* Inputs inherit font */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Focus ring for everything keyboard-reachable */
:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--jx-primary);
  outline-offset: 2px;
}

/* Image defaults */
img, svg { display: block; max-width: 100%; }

/* Selection */
::selection {
  background: var(--jx-primary);
  color: var(--jx-text-on-brand);
}

/* Scrollbar (webkit) — subtle, on hover */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--jx-border);
  border-radius: var(--rd-pill);
  border: 2px solid var(--jx-bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--jx-text-3); }

/* ── Numeric font features — better digits for stats/prices ─────────── */
.tabular-nums { font-variant-numeric: tabular-nums; }
.font-currency { font-family: var(--font-family-currency); }
.font-latin { font-family: var(--font-family-latin); }

/* ── Visually hidden (a11y) ───────────────────────────────────────────── */
.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;
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@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;
  }
}
