/*
  Reset + base element styles.
  Semantic HTML is styled directly here; utility classes in layout.css /
  components.css layer on top. Keep this file free of one-off page rules.
*/

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

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

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 200ms ease, color 200ms ease;
}

body > main {
  flex: 1 0 auto;
}

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

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

h2 {
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.15;
}

h3 {
  font-size: 20px;
  line-height: 1.25;
}

h4 {
  font-size: 16px;
  font-weight: 600;
}

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

p:last-child {
  margin-bottom: 0;
}

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

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

small {
  font-size: 14px;
  color: var(--color-text-muted);
}

ul,
ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.25em;
  color: var(--color-text-secondary);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

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

/* Visible keyboard focus everywhere -- never remove without a replacement */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-primary-subtle);
  color: var(--color-text);
}

/* Skip-to-content link for keyboard/screen-reader users */
.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-4);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: var(--color-text-on-primary);
  border-radius: var(--radius-md);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: var(--space-4);
}

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