/* ============================================================================
   ds/base.css — element defaults, money, focus, motion (Harbor)
   Loaded after aurora-global.css; equal-specificity element rules win here.
   ============================================================================ */

html {
  -webkit-text-size-adjust: 100%;
  /* anchors/focus never land under the sticky app bar or the tab bar (WCAG 2.4.11) */
  scroll-padding-block-start: calc(var(--af-appbar-h) + var(--af-safe-top) + 8px);
}

body {
  font-family: var(--af-font-body);
  font-size: var(--af-fs-md);
  line-height: 1.5;
  color: var(--af-ink);
  background: var(--af-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--af-font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--af-ink);
}

a { color: var(--af-primary-text); }
a:hover { color: var(--af-primary-hover); }
:root[data-theme="dark"] a:hover,
:root[data-ac-contrast="dark"] a:hover { color: var(--af-primary-hover); }

/* One focus ring everywhere (AccessCore data-ac-focus="enhanced" adds its own halo on top). */
:focus-visible {
  outline: 2px solid var(--af-focus);
  outline-offset: 2px;
}

::selection { background: var(--af-primary-soft); color: var(--af-ink); }

/* Screen-reader only (kept compatible with the existing .sr-only users). */
.sr-only, .af-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Money: tabular, LTR-isolated so the sign never drifts inside RTL text. */
.money {
  font-family: var(--af-font-display);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 500;
  unicode-bidi: isolate;
  direction: ltr;
  white-space: nowrap;
}
/* A block-level amount aligns with the page, not with its own LTR direction. */
[dir="rtl"] .money.money--block { text-align: right; }
[dir="ltr"] .money.money--block { text-align: left; }
/* Owner decision 3: expense = ink with minus, income = green with plus,
   transfer = blue. Red is for overspend/error only (.money--danger). */
.money--expense { color: var(--af-ink); }
.money--income { color: var(--af-income); }
.money--transfer { color: var(--af-transfer); }
.money--danger { color: var(--af-danger); }

/* Directional icons mirror in RTL; non-directional ones never do. */
[dir="rtl"] .af-i-dir { transform: scaleX(-1); }

/* Icon sprite glyphs (shell + primitives). */
.af-i {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.af-i--sm { width: 20px; height: 20px; }
.af-i--xs { width: 16px; height: 16px; }

/* Shared scroll lock: one class instead of ad-hoc body overflow sites. */
html.af-scroll-lock, html.af-scroll-lock body { overflow: hidden; }

/* Controls: no double-tap zoom delay. */
a, button, input, select, textarea, label, [role="button"] { touch-action: manipulation; }

/* Reduced motion: OS setting and AccessCore. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
:root[data-ac-motion="reduced"] *,
:root[data-ac-motion="reduced"] *::before,
:root[data-ac-motion="reduced"] *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}
