/*
 * base.css — reset, element defaults, typography, accessibility helpers and motion preferences.
 * No component or page-specific rules live here.
 */

/* ── 1. Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, pre {
  margin: 0;
}

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

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

/* ── 2. Document defaults ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;           /* 16px base; comfortable on all screens */
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;        /* safety net: decorative layers must never create sideways scroll */
  -webkit-font-smoothing: antialiased;
}

/* While the mobile drawer / a dialog / full-screen code is open, the page behind must not scroll. */
body.scroll-lock {
  overflow: hidden;
}

/* ── 3. Typography ── */
h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--text);
  padding: 1px 6px;
  border-radius: 6px;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* ── 4. Accessibility helpers ── */

/* Visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.11) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Text for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* "Skip to content" link, visible only when focused */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-sm);
  font-weight: 700;
  transform: translateY(-200%);
  transition: transform var(--t-fast) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Inline icon sprite usage: <svg class="i"><use href="#i-name"/></svg> */
.i {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 5. Reduced motion: honour the OS preference everywhere ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
