/* Reset, document rhythm, and layout primitives. Depends on tokens.css. */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--vvm-bg-base);
  color: var(--vvm-text);
  font-family: var(--vvm-font-body);
  font-size: var(--vvm-text-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

/* The hidden attribute must win over any display rule a component sets, or a
   `[hidden]` panel or notice stays on screen. */
[hidden] {
  display: none !important;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--vvm-font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

h1 {
  font-size: var(--vvm-text-display);
}

h2 {
  font-size: var(--vvm-text-title-lg);
}

h3 {
  font-size: var(--vvm-text-title-md);
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--vvm-space-lg);
}

ul,
ol {
  padding-left: 1.25em;
}

li + li {
  margin-top: var(--vvm-space-xs);
}

a {
  color: var(--vvm-action);
  text-decoration-color: var(--vvm-border-muted);
  text-underline-offset: 0.2em;
  transition: color var(--vvm-motion-quick) var(--vvm-ease);
}

a:hover {
  color: var(--vvm-action-hover);
}

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

:focus-visible {
  outline: 3px solid var(--vvm-action-hover);
  outline-offset: 2px;
  border-radius: var(--vvm-radius-sm);
}

hr {
  border: 0;
  border-top: var(--vvm-border-thin) solid var(--vvm-border-muted);
  margin: var(--vvm-space-xl) 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--vvm-surface-inset);
  padding: 0.1em 0.35em;
  border-radius: var(--vvm-radius-sm);
}

/* --- Layout primitives --- */

.page {
  width: 100%;
  max-width: var(--vvm-page-max);
  margin-inline: auto;
  padding-inline: var(--vvm-page-gutter);
}

.page--narrow {
  max-width: 760px;
}

.section {
  padding-block: var(--vvm-space-section);
}

.section--layered {
  background: var(--vvm-bg-layer);
}

.section__head {
  max-width: 62ch;
  margin-bottom: var(--vvm-space-xl);
}

.section__head p {
  color: var(--vvm-text-secondary);
  margin-bottom: 0;
}

.section__head h2 + p {
  margin-top: var(--vvm-space-sm);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 var(--vvm-space-sm);
  font-size: var(--vvm-text-meta);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vvm-action);
}

.grid {
  display: grid;
  gap: var(--vvm-space-lg);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.stack > * + * {
  margin-top: var(--vvm-space-md);
}

.lede {
  font-size: 1.125rem;
  color: var(--vvm-text-secondary);
  max-width: 60ch;
}

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

.center {
  text-align: center;
}

/* --- Accessibility helpers --- */

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

.skip-link {
  position: absolute;
  left: var(--vvm-space-md);
  top: -100px;
  z-index: 100;
  padding: var(--vvm-space-sm) var(--vvm-space-md);
  background: var(--vvm-action);
  color: var(--vvm-action-content);
  border-radius: var(--vvm-radius-md);
  font-weight: 700;
  text-decoration: none;
  transition: top var(--vvm-motion-quick) var(--vvm-ease);
}

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

/* Wide content (tables, galleries) scrolls inside its own box, never the body. */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
