/*
 * Base element styles and layout utilities.
 *
 * Linked with `data-pfusch`, so pfusch clones it into every component's shadow
 * root: these classes are available inside all components. Keep it small and
 * generic — component styles belong in the component's own css`` block.
 */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--weight-regular) var(--text-md) / 1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
/*
 * Page frame. Every page is a full load (server-side routing), so the chrome must hold its
 * place before any JS runs: <main> fills the viewport so the footer never rides up while a page
 * loads, the scrollbar gutter is reserved so content does not shift sideways when the page grows,
 * and the header/footer custom elements get their size and colour before they are defined.
 * (These selectors only match on the document; inside shadow roots they are inert.)
 */
html { scrollbar-gutter: stable; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
vg-site-header:not(:defined) {
  display: block; position: sticky; top: 0; z-index: 50;
  min-height: calc(var(--header-height) + 1px);
  background: var(--color-inverse-bg); border-bottom: 1px solid var(--color-inverse-surface);
}
vg-site-footer:not(:defined) { display: block; margin-top: var(--space-10); min-height: 232px; background: var(--color-inverse-bg); }
@media (max-width: 700px) { vg-site-footer:not(:defined) { min-height: 480px; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); font-weight: var(--weight-heavy); }
h2 { font-size: var(--text-2xl); font-weight: var(--weight-heavy); }
h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
p { margin: 0; }
a { color: var(--color-primary); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

/* Layout */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.section { padding-block: var(--space-section); }
.section--surface { background: var(--color-surface); border-block: 1px solid var(--color-border); }
.section--flush-top { padding-top: 0; }
.stack { display: grid; gap: var(--space-4); }
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Text */
.eyebrow {
  font: var(--weight-semibold) var(--text-xs) / 1.2 var(--font-body);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.muted { color: var(--color-text-muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-weight: var(--weight-bold); font-size: var(--text-sm); }
.hint { font-size: var(--text-sm); color: var(--color-text-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Inverse context (header, hero, footer) */
.inverse { background: var(--color-inverse-bg); color: var(--color-on-inverse); }
.inverse .muted, .inverse .eyebrow { color: var(--color-on-inverse-muted); }
.inverse a { color: var(--color-on-inverse); }
