/* ================================================================
   base.css — Reset, box-sizing, defaults, screen-reader helpers
   ================================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* User-selected "reduced motion" from the accessibility toolbar */
html.motion-reduced *,
html.motion-reduced *::before,
html.motion-reduced *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

body {
  margin: 0;
  min-height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; }

/* Focus ring — visible for keyboard users, invisible for mouse */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus, #b8862c);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Screen-reader-only helper */
.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;
}

::selection { background: rgba(15, 26, 46, 0.18); color: inherit; }

/* High-contrast preference — user toggle */
html.contrast-high {
  --color-ink:      #000000;
  --color-ink-2:    #0b1220;
  --color-muted:    #2f3646;
  --color-rule:     rgba(0, 0, 0, 0.35);
  --color-rule-2:   rgba(0, 0, 0, 0.55);
  --color-accent:   #7a5510;
  --color-accent-2: #5a3d09;
  --color-bg:       #fbf6ea;
  --color-bg-soft:  #f2eadc;
}

/* Also honor OS-level forced-colors mode */
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; }
  .btn { border: 1px solid CanvasText; }
}
