/* docs.gorigg.com — Material for MkDocs drawn as the rigg app (docs/platform/user-docs.md, «Tema»; #750).
   The shell, type scale and components copy static/rigg/rigg.css: a neutral top bar with the wordmark, the left menu
   like the app's .sidebar, admonitions like .alert, tables like .table, buttons like .btn, .badge as in the app.
   Only var() of the shadcn names in tokens.css, which scripts/build_userdocs.py generates from design/tokens.json
   (scripts/build_design.py, docs_css): Daylight on data-md-color-scheme="default", Show on "slate".
   No literal colours here; apps/core/tests/test_design.py checks it and the contrast of every pair (DOCS_PAIRS). */

[data-md-color-scheme] {
  --md-default-bg-color: var(--background);
  --md-default-bg-color--light: var(--background);
  --md-default-bg-color--lighter: var(--background);
  --md-default-bg-color--lightest: var(--background);
  --md-default-fg-color: var(--foreground);
  --md-default-fg-color--light: var(--muted-foreground);
  --md-default-fg-color--lighter: var(--input);
  --md-default-fg-color--lightest: var(--border);

  /* Header and the phone menu's title: neutral like the app's shell, not a coloured bar. */
  --md-primary-fg-color: var(--background);
  --md-primary-fg-color--light: var(--accent);
  --md-primary-fg-color--dark: var(--accent);
  --md-primary-bg-color: var(--foreground);
  --md-primary-bg-color--light: var(--muted-foreground);

  /* Hover and active links: the app's link colour (rigg.css, `a`). */
  --md-accent-fg-color: var(--cue);
  --md-accent-fg-color--transparent: var(--cue-soft);
  --md-accent-bg-color: var(--background);
  --md-accent-bg-color--light: var(--background);

  --md-typeset-color: var(--foreground);
  --md-typeset-a-color: var(--cue);
  --md-typeset-mark-color: var(--spike-soft);
  --md-typeset-table-color: var(--border);
  --md-typeset-table-color--light: var(--muted);
  --md-code-fg-color: var(--foreground);
  --md-code-bg-color: var(--muted);
  --md-code-hl-color: var(--spike-soft);
  --md-admonition-fg-color: var(--card-foreground);
  --md-admonition-bg-color: var(--card);

  /* Footer: the page's own colours above a rule, like the app's footer. */
  --md-footer-fg-color: var(--foreground);
  --md-footer-fg-color--light: var(--muted-foreground);
  --md-footer-fg-color--lighter: var(--muted-foreground);
  --md-footer-bg-color: var(--background);
  --md-footer-bg-color--dark: var(--background);

  --md-shadow-z1: var(--shadow-raised);
  --md-shadow-z2: var(--shadow-raised);
  --md-shadow-z3: var(--shadow-overlay);

  --md-text-font-family: var(--font-sans);
  --md-code-font-family: var(--font-mono);
}

/* ---------- Base (rigg.css «Base») ---------------------------------------------------------- */
/* Material grows the root size on wide screens; the app's sizes don't. */
html { font-size: 125%; }
body { font-variant-numeric: tabular-nums; }
::selection { background-color: var(--spike-soft); color: var(--foreground); }
/* WCAG 2.4.7/2.4.11: the app's focus ring on every control, in both themes. */
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ---------- Top bar (the app's shell strip) ----------------------------------------------- */
.md-header,
.md-header--shadow {
  background-color: var(--background);
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
.md-header__button { border-radius: var(--radius-md); color: var(--foreground); }
.md-header__button:hover { opacity: 1; background-color: var(--accent); color: var(--accent-foreground); }
.md-header__button:focus-visible { outline-offset: -3px; }
.md-header__title { font-size: 15px; font-weight: 600; }
.md-header__topic:first-child { font-weight: 600; }

/* The wordmark (templates/rigg/logo.html as partials/logo.html): shown on phones too, like the app's strip. */
.md-header__button.md-logo { display: inline-block; }
.md-logo .brand__logo,
.md-header__button.md-logo .brand__logo,
.md-nav__button.md-logo .brand__logo { display: block; width: auto; height: 22px; }
.brand__letters { fill: currentColor; }
.brand__cue { fill: var(--spike); }

/* Search: the app's .input in the bar (desktop); on a phone Material's own overlay in the same colours. */
@media screen and (min-width: 60em) {
  .md-search__input,
  .md-search__input:hover,
  [data-md-toggle="search"]:checked ~ .md-header .md-search__input {
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 15px;
  }
  .md-search__input::placeholder,
  .md-search__input + .md-search__icon { color: var(--muted-foreground); }
  .md-search__output { border: 1px solid var(--input); border-radius: var(--radius-md); }
}
.md-search-result__meta { background-color: var(--muted); color: var(--muted-foreground); }

/* «Prøv gratis» in the bar above the header (theme/main.html, block announce): the app's default button. */
.md-banner {
  background-color: var(--card);
  color: var(--card-foreground);
  border-bottom: 1px solid var(--border);
}
.md-banner__inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); font-size: 15px; line-height: 22px; }
/* The banner is .md-typeset, so these must out-rank .md-typeset a (Material's and ours below) on every state. */
.md-typeset a.rigg-cta {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border: 1px solid var(--primary-hover);
  border-radius: var(--radius);
  background-color: var(--primary);
  color: var(--primary-foreground);
  font: 600 15px/1 var(--font-sans);
  text-decoration: none;
}
.md-typeset a.rigg-cta:hover,
.md-typeset a.rigg-cta:focus,
.md-typeset a.rigg-cta:focus-visible {
  background-color: var(--primary-hover);
  color: var(--primary-foreground);
  text-decoration: none;
}
.md-typeset a.rigg-cta:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- Left menu (the app's .sidebar__link) ------------------------------------------ */
.md-nav { font-size: 15px; line-height: 22px; }
.md-nav__title { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--muted-foreground); }
.md-nav--primary .md-nav__link {
  align-items: center;
  min-height: var(--control-md);
  margin: 2px 0 0;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  font-weight: 400;
}
.md-nav--primary .md-nav__link[href]:hover,
.md-nav--primary .md-nav__link[for]:hover {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}
.md-nav--primary .md-nav__link:focus-visible { outline-offset: -3px; } /* inside the scrolling column, never clipped */
.md-nav--primary .md-nav__link--active,
.md-nav--primary .md-nav__link--active[href]:hover,
.md-nav--primary .md-nav__link--active[for]:hover {
  background-color: var(--spike-soft);
  color: var(--foreground);
  box-shadow: inset 3px 0 0 var(--foreground);
}
/* A section's name (navigation.sections) is a heading over its pages, like a group in the app's menu. */
.md-nav--primary .md-nav__item--section > .md-nav__link {
  color: var(--sidebar-foreground);
  font-weight: 600;
}
.md-nav--primary .md-nav__item--section > .md-nav__link:hover { background-color: transparent; color: var(--sidebar-foreground); }
/* The page's contents (right column, or inside the phone menu) mark the section being read with the link colour only. */
.md-nav--secondary .md-nav__link { color: var(--muted-foreground); }
.md-nav--primary .md-nav--secondary .md-nav__link--active,
.md-nav--secondary .md-nav__link--active {
  background-color: transparent;
  box-shadow: none;
  color: var(--cue);
}
/* Phone menu (drawer): the app's 48px rows, without Material's rules between them. */
@media screen and (max-width: 76.234375em) {
  .md-nav--primary .md-nav__item { border-top: 0; }
  .md-nav--primary .md-nav__link { min-height: var(--control-lg); }
  .md-nav--primary .md-nav__title { border-bottom: 1px solid var(--border); color: var(--foreground); }
}

/* ---------- Content: the app's type scale (rigg.css «Base» and design/README.md) ---------- */
.md-typeset { font-size: 15px; line-height: 22px; }
.md-typeset h1,
.md-typeset h2,
.md-typeset h3 { color: var(--foreground); letter-spacing: 0; text-wrap: balance; }
.md-typeset h1 { margin: 0 0 var(--space-5); font-family: var(--font-display); font-size: 32px; line-height: 36px; font-weight: 600; }
.md-typeset h2 { margin: var(--space-6) 0 var(--space-3); font-family: var(--font-sans); font-size: 22px; line-height: 28px; font-weight: 600; }
.md-typeset h3 { margin: var(--space-5) 0 var(--space-2); font-family: var(--font-sans); font-size: 17px; line-height: 24px; font-weight: 600; }
.md-typeset a { text-underline-offset: 0.18em; text-decoration: underline; text-decoration-thickness: 1px; }
.md-typeset a:hover { color: var(--cue); text-decoration-thickness: 2px; }
.md-typeset .headerlink { text-decoration: none; }
.md-typeset code,
.md-typeset kbd { font-size: 13px; }
.md-typeset code { border-radius: var(--radius-sm); }
.md-typeset pre > code { border: 1px solid var(--border); border-radius: var(--radius-md); }
.md-typeset kbd {
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  box-shadow: none;
  color: var(--muted-foreground);
}
.md-typeset img { border-radius: var(--radius-md); }

/* Tables: the app's .table inside a card. */
.md-typeset table:not([class]) {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  color: var(--card-foreground);
  font-size: 15px;
  line-height: 22px;
}
.md-typeset table:not([class]) th {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--input);
  background-color: var(--card);
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  vertical-align: bottom;
}
.md-typeset table:not([class]) td { padding: 10px var(--space-3); border-top: 0; border-bottom: 1px solid var(--border); }
.md-typeset table:not([class]) tbody tr:last-child td { border-bottom: 0; }
.md-typeset table:not([class]) tbody tr:hover { background-color: transparent; box-shadow: none; }

/* Admonitions: the app's .alert — a tinted box with a 1px border in the tone, the icon in the tone, text in
   --foreground. `!!! note|info|tip|question|example` is info, `success` ok, `warning` warn, `danger|failure|bug`
   danger; `abstract`, `quote` and the rest stay a neutral card. */
.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: none;
  font-size: 15px;
  line-height: 22px;
}
.md-typeset .admonition-title,
.md-typeset summary { background-color: transparent; font-weight: 600; }
.md-typeset :is(.admonition, details) > :is(.admonition-title, summary)::before { background-color: var(--muted-foreground); }
.md-typeset :is(.admonition, details):is(.note, .info, .tip, .question, .example) { border-color: var(--cue); background-color: var(--cue-soft); color: var(--foreground); }
.md-typeset :is(.note, .info, .tip, .question, .example) > :is(.admonition-title, summary) { background-color: transparent; }
.md-typeset :is(.note, .info, .tip, .question, .example) > :is(.admonition-title, summary)::before { background-color: var(--cue); }
.md-typeset :is(.admonition, details).success { border-color: var(--ok); background-color: var(--ok-soft); color: var(--foreground); }
.md-typeset .success > :is(.admonition-title, summary) { background-color: transparent; }
.md-typeset .success > :is(.admonition-title, summary)::before { background-color: var(--ok); }
.md-typeset :is(.admonition, details).warning { border-color: var(--warn); background-color: var(--warn-soft); color: var(--foreground); }
.md-typeset .warning > :is(.admonition-title, summary) { background-color: transparent; }
.md-typeset .warning > :is(.admonition-title, summary)::before { background-color: var(--warn); }
.md-typeset :is(.admonition, details):is(.danger, .failure, .bug) { border-color: var(--danger); background-color: var(--danger-soft); color: var(--foreground); }
.md-typeset :is(.danger, .failure, .bug) > :is(.admonition-title, summary) { background-color: transparent; }
.md-typeset :is(.danger, .failure, .bug) > :is(.admonition-title, summary)::before { background-color: var(--danger); }
.md-typeset :is(.abstract, .quote) > :is(.admonition-title, summary) { background-color: transparent; }
.md-typeset :is(.admonition, details):is(.abstract, .quote) { border-color: var(--input); }
.md-typeset :is(.abstract, .quote) > :is(.admonition-title, summary)::before { background-color: var(--muted-foreground); }

/* Buttons: `[Tekst](lenke){ .md-button }` is the app's outline button, `.md-button--primary` the default one. */
.md-typeset .md-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background-color: var(--card);
  color: var(--card-foreground);
  font: 600 15px/1 var(--font-sans);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.md-typeset .md-button:hover,
.md-typeset .md-button:focus-visible { border-color: var(--input); background-color: var(--accent); color: var(--accent-foreground); }
.md-typeset .md-button--primary { border-color: var(--primary-hover); background-color: var(--primary); color: var(--primary-foreground); }
.md-typeset .md-button--primary:hover,
.md-typeset .md-button--primary:focus-visible { border-color: var(--primary-hover); background-color: var(--primary-hover); color: var(--primary-foreground); }

/* Badges: `<span class="badge badge--ok">Ferdig</span>` in an article, the app's pill (always a word, never colour alone). */
.md-typeset .badge {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background-color: var(--muted);
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.md-typeset .badge--outline { border-color: var(--input); background-color: transparent; color: var(--foreground); }
.md-typeset .badge--ok { background-color: var(--ok-soft); color: var(--ok); }
.md-typeset .badge--warn { background-color: var(--warn-soft); color: var(--warn); }
.md-typeset .badge--destructive { background-color: var(--danger-soft); color: var(--destructive); }
.md-typeset .badge--info { background-color: var(--cue-soft); color: var(--cue); }

/* ---------- Footer (the app's quiet footer) ----------------------------------------------- */
.md-footer { border-top: 1px solid var(--border); }
.md-footer__link:hover,
.md-footer__link:focus-visible { opacity: 1; color: var(--cue); }
.md-footer-meta { font-size: 13px; }
