/* Typography, resets and focus on top of W3.CSS. Values come from theme.css only. */

html { font-size: var(--text-base); }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* W3.CSS sets its own font on these; take them back. */
html, body, h1, h2, h3, h4, h5, h6, button, input, select, textarea {
  font-family: var(--font-sans);
}

h1, h2, h3, h4 { margin: 0; line-height: var(--leading-tight); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }
p { margin: 0; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

code, kbd, pre, .pk-mono { font-family: var(--font-mono); font-size: 0.92em; }

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

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-focus-ring);
  border-radius: var(--radius-sm);
}

* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }

.pk-muted   { color: var(--color-text-muted); }
.pk-subtle  { color: var(--color-text-subtle); }
.pk-small   { font-size: var(--text-sm); }
.pk-xs      { font-size: var(--text-xs); }
.pk-num     { font-variant-numeric: tabular-nums; text-align: right; }

/* `hidden` always wins over component display rules (badges, flex rows…). */
[hidden] { display: none !important; }

.pk-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;
}

.pk-skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 1000;
  padding: var(--space-2) var(--space-4); background: var(--color-surface);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
}
.pk-skip-link:focus { top: var(--space-2); }

.pk-icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pk-icon--20 { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
