/* Base: reset, typography, focus, page layout. Colours come only from tokens.css. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--color-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-callout);
  line-height: var(--leading-callout);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

/* Zero specificity so component padding always wins. */
:where(ul[class], ol[class]) {
  padding: 0;
  list-style: none;
}

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

svg.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
}

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

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

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

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--color-accent-tint-hover);
  color: var(--color-text);
}

/* Typography scale */
.large-title { font-size: var(--text-large-title); line-height: var(--leading-large-title); font-weight: 700; letter-spacing: -0.015em; }
.title-1 { font-size: var(--text-title-1); line-height: var(--leading-title-1); font-weight: 700; letter-spacing: -0.01em; }
.title-2 { font-size: var(--text-title-2); line-height: var(--leading-title-2); font-weight: 600; letter-spacing: -0.005em; }
.title-3 { font-size: var(--text-title-3); line-height: var(--leading-title-3); font-weight: 600; }
.headline { font-size: var(--text-headline); line-height: var(--leading-headline); font-weight: 600; }
.callout { font-size: var(--text-callout); line-height: var(--leading-callout); }
.subhead { font-size: var(--text-subhead); line-height: var(--leading-subhead); }
.footnote { font-size: var(--text-footnote); line-height: var(--leading-footnote); }
.caption { font-size: var(--text-caption); line-height: var(--leading-caption); }
.secondary { color: var(--color-text-secondary); }
.num, .table td, .kpi__value, .barlist__value, time { font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }

.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;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  background: var(--color-surface-raised);
  color: var(--color-accent-text);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

/* Page layout */
.page {
  width: 100%;
  margin-inline: auto;
  padding-top: var(--space-6);
  padding-bottom: calc(var(--space-12) + env(safe-area-inset-bottom));
  padding-left: calc(var(--gutter) + env(safe-area-inset-left));
  padding-right: calc(var(--gutter) + env(safe-area-inset-right));
}

.page--narrow {
  max-width: calc(48rem + 2 * var(--gutter));
}

.page--dashboard {
  max-width: calc(var(--content-dashboard) + 2 * var(--gutter));
}

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

.stack-lg > * + * {
  margin-top: var(--grid-gap);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row--wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

[hidden] {
  display: none !important;
}

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