/* ============================================================================
   PoliMoney — Base  (base.css)
   Modern reset + root/body defaults + typography defaults + focus-visible +
   selection + prefers-reduced-motion baseline + scroll-behavior.
   Depends on tokens.css (Design Tokens v2 — navy-dominant).
   ============================================================================ */

/* ---------------------------------------------------------------- *
 * Modern reset
 * ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* keep anchored content clear of the sticky header */
  scroll-padding-top: 5.5rem;
  -moz-tab-size: 4;
  tab-size: 4;
  color-scheme: dark;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  font-weight: var(--fw-regular);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv01";
  overflow-x: hidden;
}

/* Media defaults */
img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  fill: none;
}

/* Forms inherit type */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

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

/* Lists used as nav/menus lose default bullets only via utility/component;
   keep semantic lists styled by default. */

/* Anchors */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--primary-200);
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
}

/* Avoid orphan-heavy long words breaking layout */
p,
li,
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

/* Balance short headings for premium look (progressive enhancement) */
h1,
h2,
h3 {
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- *
 * Typography defaults
 * ---------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-extra);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); letter-spacing: var(--tracking-snug); }
h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
}
h4 {
  font-size: var(--fs-lg);
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-normal);
}

strong,
b {
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

small {
  font-size: var(--fs-xs);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* Tabular figures for any data-bearing element */
.tabular-nums,
[data-nums] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------------------------------------------------------------- *
 * Focus-visible — highly visible teal ring (AA, 9.33 on bg).
 * Interactive components (buttons/inputs/toggles) override this with the
 * two-part --focus-ring box-shadow; this outline is the global fallback.
 * ---------------------------------------------------------------- */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-color);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
/* Remove the legacy outline when :focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* ---------------------------------------------------------------- *
 * Selection
 * ---------------------------------------------------------------- */
::selection {
  background-color: var(--teal-400);
  color: var(--navy-900);
}

/* ---------------------------------------------------------------- *
 * Custom scrollbar (subtle, on-brand)
 * ---------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-700) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--neutral-700);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-600);
  background-clip: padding-box;
}

/* ---------------------------------------------------------------- *
 * Screen-reader-only + skip link helpers
 * ---------------------------------------------------------------- */
.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;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: var(--z-max);
  padding: var(--space-3) var(--space-5);
  background: var(--primary-fill);
  color: var(--text-on-accent);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-4);
  color: var(--text-on-accent);
}

/* ---------------------------------------------------------------- *
 * prefers-reduced-motion baseline — neutralize all motion globally.
 * Components add their own guarded animations on top of this.
 * ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
