/* /vis: the palette and form the visualisations share.
 *
 * Unlike the rest of msge.no this family follows the reader's colour scheme,
 * light and dark, because a chart is read on whatever background the reader
 * chose. Tokens are declared on :root and redeclared for dark; nothing below
 * the token blocks names a colour of its own.
 *
 * The twelve --k-* category colours are /vis/mm's (design handoff v2). Each
 * category also has a two-letter code, and the code travels with the colour
 * everywhere (legend, badges, tiles, stack segments, table rows), so colour is
 * never the only cue. That is also what let the light steps be darkened: every
 * fill clears 3:1 on the light surface, and a code set on a fill in --on
 * clears 4.5:1, in both schemes. Measured pairs are in test/contrast.test.js.
 *
 * --graa is the faint text (section numbers, the "Anna" category), --rutenett
 * the hairline for grids and tracks. The tooltip inverts the scheme, which is
 * why it has its own three tokens. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #1c1d21;
  --muted: #53565d;
  --line: #dcd9d1;
  --lenke: #17518f;
  --graa: #707279;
  --rutenett: #e9e6df;
  --hover: #f1efe9;
  --fokus: #17518f;
  --tip-bg: #1c1d21;
  --tip-fg: #fbfaf7;
  --tip-sub: #d6d8dc;
  --on: #ffffff;

  --k-ball: #c94c1b;
  --k-vatn: #0f8259;
  --k-nordisk: #a03a8e;
  --k-alpint: #9d6b00;
  --k-uthald: #2867c2;
  --k-friidrett: #8f531c;
  --k-kamp: #58810a;
  --k-styrke: #0b7783;
  --k-dans: #c23f78;
  --k-motor: #b3361f;
  --k-eventyr: #4a3aa7;
  --k-presisjon: #00770a;
  --k-anna: #707279;

  --font-disp: Fraunces, Georgia, serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a1f;
    --panel: #1e242b;
    --ink: #eef0f2;
    --muted: #aeb6c0;
    --line: #36404b;
    --lenke: #8cc0ff;
    --graa: #8f98a3;
    --rutenett: #2a323b;
    --hover: #242b33;
    --fokus: #8cc0ff;
    --tip-bg: #eef0f2;
    --tip-fg: #161a1f;
    --tip-sub: #3a414a;
    --on: #161a1f;

    --k-ball: #f07a45;
    --k-vatn: #2fc08c;
    --k-nordisk: #d46cc2;
    --k-alpint: #f0b429;
    --k-uthald: #5b9cf0;
    --k-friidrett: #c88a52;
    --k-kamp: #9bc93a;
    --k-styrke: #3fbfcc;
    --k-dans: #f08cb8;
    --k-motor: #f06a52;
    --k-eventyr: #a597f5;
    --k-presisjon: #3cc04a;
    --k-anna: #8f98a3;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-ui);
}
a { color: var(--lenke); text-underline-offset: 0.15em; }
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 16px; top: -40px; z-index: 10;
  background: var(--panel); color: var(--ink); padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 6px;
}
.skip-link:focus { top: 8px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.vis-ramme { max-width: 980px; margin: 0 auto; padding: 16px 16px 48px; }
.vis-sti { font-size: 0.875rem; color: var(--muted); margin: 0 0 18px; }
.vis-sti a { color: var(--muted); }
.vis-sti a:hover { color: var(--lenke); }
h1 {
  font-family: var(--font-disp); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(1.75rem, 5vw, 2.6rem); line-height: 1.1; margin: 0 0 10px;
}
h2 { font-family: var(--font-disp); font-weight: 600; font-size: 1.35rem; margin: 0 0 6px; }
.ingress { color: var(--muted); max-width: 62ch; margin: 0 0 8px; }

.vis-kort {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 20px 0 0;
}
.lesehjelp { color: var(--muted); font-size: 0.9375rem; margin: 0 0 12px; max-width: 70ch; }
.vis-merknad { color: var(--muted); font-size: 0.875rem; margin: 10px 0 0; }

.vis-liste { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.vis-liste a { display: block; text-decoration: none; color: inherit; }
.vis-liste a:hover h2, .vis-liste a:focus-visible h2 { color: var(--lenke); text-decoration: underline; }
.vis-liste p { margin: 0; color: var(--muted); }

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