:root {
  --bg: #f4f7fb;
  --menu: #eef3f8;
  --article: #ffffff;
  --text: #162132;
  --muted: #5f6c7b;
  --line: #d8e2ed;

  --accent: #4f7f57;
  --accent-dark: #3f6846;
  --accent-soft: #e8f2ea;

  --toc-active-bg: #dfe9ff;
  --toc-active-text: #153f9f;
  --toc-l1: #1f2c3b;
  --toc-l2: #4f5d6c;
  --toc-l3: #4f5d6c;
  --toc-l4: #4f5d6c;

  --max: 1240px;
  --menu-w: 300px;
  --content-w: 820px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--menu-w) 1fr;
  gap: 0;
  padding: 0;
}

/* MENU */

.menu {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 18px 28px;
  background: var(--menu);
  border-left: 1px solid #cfd8e3;
  border-right: 1px solid var(--line);
}

.cover {
  width: 94px;
  aspect-ratio: 1;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 16px;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.menu p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* SEARCH */

.search {
  position: sticky;
  top: 0;
  margin: 20px 0 18px;
  padding-bottom: 10px;
  background: linear-gradient(180deg, rgba(238,243,248,1) 70%, transparent);
  z-index: 2;
}

.search input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 40px 0 14px; /* plass til kryss */
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

#clearSearch {
  position: absolute;
  right: 10px;
  top: 22px; /* justert til input-feltet */
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #6b7785;
  font-size: 18px;
  cursor: pointer;
  display: none;
}

#clearSearch:hover {
  background: rgba(0,0,0,0.05);
}

.search.has-value #clearSearch {
  display: block;
}

.search input:focus,
.search input:focus-visible {
  border-color: #b7c8d9;
  box-shadow: 0 0 0 3px rgba(79, 127, 87, 0.12);
}

/* TOC */

.label {
  display: none;
}

#toc a,
#toc a:visited,
#toc a:hover,
#toc a:active {
  color: inherit;
  text-decoration: none;
}

.item {
  display: block;
  padding: 6px 12px;
  border-radius: 12px;
  margin: 1px 0;
  line-height: 1.3;
  color: #2d3a4a;
}

.item:hover {
  background: rgba(255,255,255,.5);
}

.item.l1 {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--toc-l1);
}

.item.l2 {
  padding-left: 28px;
  font-size: 14px;
  font-weight: 400;
  color: var(--toc-l2);
}

.item.l3 {
  padding-left: 40px;
  font-size: 13px;
  font-weight: 400;
  color: var(--toc-l3);
}

.item.l4 {
  padding-left: 60px;
  font-size: 12px;
  font-weight: 400;
  color: var(--toc-l4);
}

.item.on {
  background: var(--toc-active-bg);
  color: var(--toc-active-text);
}

/* ARTICLE */

main {
  background: var(--article);
  padding: 34px 0 92px 28px;
  min-height: 100vh;
  border-right: 1px solid var(--line);
}

article {
  max-width: var(--content-w);
  padding-right: 24px;
}

.crumbs {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

.title {
  margin: 0 0 18px;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text);
}

.image {
  position: relative;
  margin: 20px 0 20px;
  border-radius: 24px;
  overflow: hidden;
  background: #eef3f8;
}

.fr-video {
  display: block;
  width: 100%;
}

.fr-video iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
}

.image img {
  display: block;
  width: 100%;
  height: auto;
}

.intro {
  margin: 4px 0 28px;
  max-width: 36em;
  font-size: 20px;
  line-height: 1.55;
  color: #3f5163;
  font-weight: 500;
}

.note {
  margin: 0 0 26px;
  padding: 20px;
  border: 1px solid #d7e4ff;
  border-radius: 20px;
  background: #fbfdff;
}

/* CONTENT TYPOGRAPHY */

.content {
  font-size: 16px;
  line-height: 1.7;
  color: #2c3a4b;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.content h1 {
  margin: 30px 0 10px;
  font-size: 24px;
}

.content h2 {
  margin: 28px 0 8px;
  font-size: 20px;
}

.content h3 {
  margin: 24px 0 6px;
  font-size: 17px;
}

.content h4 {
  margin: 22px 0 6px;
  font-size: 15px;
}

.content p {
  margin: 0 0 14px;
}

.content ul,
.content ol {
  margin: 10px 0 16px 30px;
  padding: 0;
}

.content li {
  margin: 4px 0;
}

.content blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  background: #f6f7f9;
  border-left: 4px solid #d5dae1;
  color: #445262;
  font-style: italic;
}

.content blockquote p:last-child {
  margin-bottom: 0;
}

/* SEARCH RESULTS IN MENU */

.search-results {
  padding-top: 4px;
}

.search-meta,
.search-empty {
  margin: 0 0 10px;
  font-size: 13px;
  color: #6b7785;
  font-weight: 600;
}

.search-hit,
.search-hit:visited,
.search-hit:hover,
.search-hit:active {
  display: block;
  padding: 8px 12px;
  border-radius: 12px;
  margin: 1px 0;
  color: #2d3a4a;
  text-decoration: none;
  line-height: 1.35;
}

.search-hit:hover {
  background: rgba(255,255,255,.5);
}

.search-hit.on {
  background: var(--toc-active-bg);
}

.search-hit-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.search-hit.on .search-hit-title {
  color: var(--toc-active-text);
  font-weight: 700;
}

/* FLOAT BUTTONS */

.nav {
  position: fixed;
  bottom: 22px;
  right: max(22px, calc((100vw - min(var(--max), 100vw)) / 2 + 22px));
  display: flex;
  gap: 12px;
  z-index: 20;
}

.nav svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav button:disabled svg {
  stroke: #eef1f4;
}

.nav a,
.nav button,
.menubtn {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  display: grid;
  place-items: center;
}

.nav a:hover,
.nav button:hover,
.menubtn:hover {
  background: var(--accent-dark);
  color: white;
  text-decoration: none;
}

.nav button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.nav button:disabled {
  background: #b8c0c8;
  color: #eef1f4;
  cursor: default;
  box-shadow: none;
}

.nav button:focus-visible,
.menubtn:focus-visible {
  outline: 3px solid rgba(79, 127, 87, 0.2);
  outline-offset: 2px;
}

/* MOBILE */

.menubtn {
  display: none;
  position: fixed;
  left: 16px;
  bottom: 22px;
}

.shade {
  position: fixed;
  inset: 0;
  background: rgba(12,18,28,.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.shade.on {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .wrap {
    grid-template-columns: 1fr;
  }

  .menu {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(320px, 86vw);
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 20;
  }

  .menu.show {
    transform: translateX(0);
  }

  .menubtn {
    display: block;
    z-index: 30;
  }

  main {
    padding-left: 20px;
    padding-right: 20px;
  }

  article {
    padding-right: 0;
  }

  .nav {
    right: 18px;
  }

  .title {
    font-size: 34px;
  }

  .intro {
    font-size: 17px;
  }

  .content h1 {
    font-size: 22px;
  }

  .content h2 {
    font-size: 19px;
  }

  .content h3 {
    font-size: 16px;
  }
}

