/* Reset, base typography and accessibility helpers. Logical properties only (RTL-first). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  background-image: var(--c-bg-glow);
  background-attachment: fixed;
  margin: 0;
  min-height: 100dvh;
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-bold); }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0; }
small { font-size: var(--fs-sm); }

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

img, svg { display: block; max-width: 100%; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
[dir="rtl"] .icon--dir { transform: scaleX(-1); } /* arrows that must follow reading direction */

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

table { border-collapse: collapse; width: 100%; }

hr { border: 0; border-block-start: 1px solid var(--c-border); margin: var(--sp-6) 0; }

/* Numbers that must not be reordered by bidi (phones, file numbers, amounts in mixed text) */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.num { font-variant-numeric: tabular-nums; }

/* Focus: clearly visible for keyboard users only */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--brand-lime); color: #000; }

.visually-hidden {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--sp-2);
  inset-inline-start: var(--sp-2);
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-accent);
  color: var(--c-accent-text);
  border: 0;
  border-radius: var(--radius-md);
  font-weight: var(--fw-bold);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible { transform: none; }

[hidden] { display: none !important; }

/* Utilities (kept deliberately small) */
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-inline-size: 0; }
.muted { color: var(--c-text-muted); }
.subtle { color: var(--c-text-subtle); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.bold { font-weight: var(--fw-bold); }
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
