/* Reset and base typography. Everything sizes in rem so --ui-scale drives it. */

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

/* The `hidden` attribute has to beat our own layout rules (GSF-0065).
 * The browser's own `[hidden] { display: none }` lives in the user-agent
 * stylesheet, so **any** author rule that sets `display` outranks it —
 * `.navbtn { display: flex }` did exactly that, and `btn.hidden = true`
 * silently stopped hiding anything. Found on the new Sperren button, which
 * appeared without a PIN set; `#btn-logout` carried the same latent defect,
 * masked only because `body.is-logged-out` hides the whole sidebar anyway. */
[hidden] {
  display: none !important;
}

html {
  font-size: calc(16px * var(--ui-scale));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: var(--weight-normal);
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* The background image is applied through a custom property set from JS.
 * A <style> block or a style="" attribute would need a CSP exception; setting
 * a custom property does not. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--bg-image, none);
  background-size: cover;
  background-position: center;
  opacity: var(--bg-image-opacity);
  pointer-events: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: var(--weight-bold);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.15rem;
}
h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 var(--space-3);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

:where(a) {
  color: var(--ui-accent);
}

/* Visible focus everywhere — the app is used with wet hands and gloves, and
 * keyboard users need it on the desktop. */
:focus-visible {
  outline: 3px solid var(--ui-accent);
  outline-offset: 2px;
}

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

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

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