/*
  base.css — element defaults. Mobile-first; breakpoints at 768px and 1440px per plan §0.4's
  screenshot widths (390/768/1440). No external @import, no url(http…) anywhere in this tree
  (docs/build-contract.md §6/§7 — zero external requests from the published site).
*/

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  color: var(--text-primary);
  background: var(--bg);
  /* Sticky footer (G5.5). The short pages — /contact/, /privacy/, /404.html — did not fill the
     viewport, so the footer band ended halfway down the screen with a strip of empty page below
     it, which reads as a rendering fault. `main` takes the slack instead. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1 0 auto;
}

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

h1 { font-size: var(--text-3xl); line-height: var(--leading-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
}

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

small {
  font-size: var(--text-sm);
}

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

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

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

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

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

button {
  cursor: pointer;
}

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

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

table {
  border-collapse: collapse;
}

/* main layout container */
.container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* wide content (tables, code) scrolls inside its own container, never the page */
.scroll-x {
  overflow-x: auto;
  max-width: 100%;
}

/* visually-hidden but screen-reader accessible (e.g. polite filter-count region) */
.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;
}

/* `hidden` must win over a component's own display value. Both JavaScript-only controls (the theme
   toggle and the projects filter bar) ship with the `hidden` attribute and are revealed by
   site/src/js/app.js, and the filter bar hides non-matching cards the same way — without this rule
   a `display: flex` component would ignore `hidden` entirely (G5.5). */
[hidden] {
  display: none !important;
}

/* keyboard-focus ring — every interactive element in this tree */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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