/* Reset & typography */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: var(--color-bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0 0 var(--space-sm); font-family: var(--font-heading); line-height: var(--line-height-tight); }
h1 { font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-heading); }
h2 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); letter-spacing: calc(var(--tracking-heading) / 2); }
h3 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
p { margin: 0 0 var(--space-md); }
small, .text-sm { font-size: var(--font-size-sm); }
.text-muted { color: var(--color-text-muted); }

a { color: var(--color-secondary); text-decoration-thickness: 0.08em; text-underline-offset: 0.15em; }
a:hover { color: var(--color-secondary-hover); }

img, svg { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

::selection { background: var(--color-secondary-soft); }

.visually-hidden {
  position: absolute !important;
  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(--space-md);
  top: -4rem;
  z-index: 1000;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lift);
  transition: top var(--duration) var(--ease);
}
.skip-link:focus { top: var(--space-md); }

.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 2rem; height: 2rem; }
.icon-xl { width: 3rem; height: 3rem; }

/* The logo symbol takes its colors from tokens, so a design can recolor it. */
.logo-bg { fill: var(--logo-bg); }
.logo-fg { fill: var(--logo-fg); }
.logo-dot { fill: var(--logo-dot); }

/* Programmatic focus targets (e.g. <main tabindex="-1">) need no ring. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; }

/* Forced colours (e.g. Windows high contrast) drop box-shadow, so the focus ring
   needs an outline there; it overrides the components' "outline: none". */
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight !important; outline-offset: 2px; }
  [tabindex="-1"]:focus-visible { outline: none !important; }
}
