/* Tilgjengelig, lesbart oppsett. WCAG 2.2 AA: kontrast, fokus, tekstskalering. */

:root {
  --tekst: #1a1a1a;
  --bakgrunn: #ffffff;
  --lenke: #0b4f9c; /* kontrast >= 7:1 mot hvitt */
  --lenke-besokt: #6a2a8c;
  --kant: #6b7280;
  --aksent: #f3f4f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--tekst);
  background: var(--bakgrunn);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
}

a {
  color: var(--lenke);
}
a:visited {
  color: var(--lenke-besokt);
}

/* Tydelig, ikke-fjernet fokusmarkering for tastaturnavigasjon. */
a:focus-visible,
:focus-visible {
  outline: 3px solid var(--lenke);
  outline-offset: 2px;
}

/* Hopp-til-innhold: skjult til den får fokus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--lenke);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

.site-header,
.site-footer {
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: var(--aksent);
  border-bottom: 1px solid var(--kant);
}
.site-footer {
  border-bottom: none;
  border-top: 1px solid var(--kant);
  font-size: 0.95rem;
}
.site-title {
  font-weight: 700;
  text-decoration: none;
}

.site-main {
  max-width: 70ch; /* behagelig lesebredde */
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 4rem;
}

h1 {
  line-height: 1.25;
}

.doc-list {
  list-style: none;
  padding: 0;
}
.doc-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--aksent);
}

.breadcrumb {
  font-size: 0.95rem;
}

.document-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  background: var(--aksent);
  padding: 1rem;
  border-radius: 6px;
}
.document-meta dt {
  font-weight: 700;
}
.document-meta dd {
  margin: 0;
}

.toc {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--kant);
  border-radius: 6px;
}
.toc h2 {
  margin-top: 0;
}

.document-body {
  margin-top: 2rem;
}
/* Marker leddet man hopper til via TOC/anker. */
.document-body :target {
  background: #fff3cd;
  outline: 2px solid #b8860b;
}

/* Forside: filter, liste, paginering */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 1.5rem;
}
.filter-form input[type="search"] {
  flex: 1 1 16rem;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--kant);
  border-radius: 4px;
}
.filter-form button {
  padding: 0.5rem 1.25rem;
  background: var(--lenke);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.type-tag {
  font-size: 0.8rem;
  color: #555;
  margin-left: 0.4rem;
}
.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1.5rem 0;
}

/* Statistikk-tabeller */
.stats {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
}
.stats caption {
  text-align: left;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.stats th,
.stats td {
  border: 1px solid var(--kant);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.stats thead th {
  background: var(--aksent);
}
.stats td {
  text-align: right;
}

/* Tidsmaskin */
.timemachine {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.as-of-banner {
  background: #fff3cd;
  border: 1px solid #9a6700;
  border-radius: 6px;
  padding: 0.6rem 1rem;
}

/* Søk */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 2rem;
}
.search-form input[type="search"] {
  flex: 1 1 16rem;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--kant);
  border-radius: 4px;
}
.search-form button {
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  background: var(--lenke);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.hits {
  list-style: none;
  padding: 0;
}
.hits li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--aksent);
}
.snippet {
  margin: 0.25rem 0 0;
  color: #333;
}
mark {
  background: #fff3a3;
  color: #1a1a1a;
  padding: 0 0.1em;
}
.site-header nav {
  display: inline;
  margin-left: 1rem;
}
.site-header nav a {
  margin-right: 1rem;
}

/* Endringshistorikk og diff */
.history {
  line-height: 2;
}
.badge {
  background: var(--lenke);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.changes {
  list-style: none;
  padding: 0;
}
.change {
  border-left: 6px solid var(--kant);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--aksent);
}
/* Status markeres med tekst-tag OG kantfarge — aldri farge alene. */
.change--added {
  border-left-color: #1a7f37;
}
.change--removed {
  border-left-color: #b3261e;
}
.change--changed {
  border-left-color: #9a6700;
}
.change-tag {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  color: #fff;
}
.change-tag--added {
  background: #1a7f37;
}
.change-tag--removed {
  background: #b3261e;
}
.change-tag--changed {
  background: #9a6700;
}
.change-id {
  font-weight: 700;
  margin-left: 0.5rem;
}
.vlabel {
  font-weight: 700;
}
del {
  background: #ffe9e9;
  text-decoration: line-through;
}
ins {
  background: #e6ffec;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
