/*
 * shared/styles/base.css — global reset + element defaults (doc 10 §12; PC-52).
 *
 * Served concatenated AFTER variables.css by GET /__assets/base.css, and imported by
 * shared/entry-client.js for the hashed prod bundle. Import order everywhere:
 * variables.css → base.css → component <style> blocks.
 *
 * RTL: only logical properties/values here (no left/right) — dir="rtl" on <html> flips
 * everything for free (doc 14).
 */

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

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ── typography ─────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

h1 { font-size: var(--font-size-3xl); line-height: var(--line-height-tight); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-2xl); line-height: var(--line-height-tight); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--font-size-xl); line-height: var(--line-height-tight); font-weight: var(--font-weight-semibold); }
h4 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
h5, h6 { font-size: var(--font-size-md); font-weight: var(--font-weight-semibold); }

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

::selection {
  background: var(--color-selection-bg);
}

/* ── links ──────────────────────────────────────────────────────────────────── */

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ── media ──────────────────────────────────────────────────────────────────── */

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

/* ── lists (opt back in with a class when semantics need bullets) ───────────── */

ul, ol {
  margin: 0;
  padding-inline-start: 0;
  list-style: none;
}

/* ── forms + buttons ────────────────────────────────────────────────────────── */

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

textarea {
  resize: vertical;
}

/* ── tables ─────────────────────────────────────────────────────────────────── */

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

th {
  text-align: start; /* logical — follows dir */
  font-weight: var(--font-weight-semibold);
}

/* ── focus (keyboard-only ring; never remove without replacement) ───────────── */

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* ── scrollbars (subtle, token-driven) ──────────────────────────────────────── */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ── utilities the foundation owns ──────────────────────────────────────────── */

/* body scroll lock while a Modal is open (counter-managed by Modal.vue) */
.scroll-locked {
  overflow: hidden;
}

/* visually hidden, still readable by assistive tech */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* skip-to-content link (DashboardLayout a11y — visible on focus only) */
.skip-link {
  position: absolute;
  inset-block-start: -100%;
  inset-inline-start: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-raised);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.skip-link:focus-visible {
  inset-block-start: var(--space-2);
}

/* ── motion safety ──────────────────────────────────────────────────────────── */

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