/* Reset & base element styles */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  overflow-x: hidden;
}

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

/* Form controls do NOT inherit colour by default - the UA stylesheet sets
   `color: buttontext` (black). Without this, every unstyled button/select
   label renders black, which is invisible on dark-theme surfaces. Inherit
   instead so they follow whatever --color-text resolves to. */
button,
select,
input,
textarea {
  color: inherit;
  font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--line-height-tight);
  font-weight: 300;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3, h4, h5, h6 { font-weight: 500; }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

a {
  /* accent-text, not accent: raw #E18000 on white is ~2.9:1 and fails AA for text */
  color: var(--color-accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--color-text);
}

small, .text-muted {
  color: var(--color-text-muted);
}

ul, ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

code, pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* Accessibility: visible focus state everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: var(--space-3) var(--space-5);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

* {
  scrollbar-color: var(--color-border-strong) var(--color-bg);
}

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