/* =========================================================
   FOSS Rådgivning – «Tusj»-stilen
   ---------------------------------------------------------
   Ren og lys flate, store overskrifter, og viktige ord
   markert med overstrykningstusj.
   Skriv <em> i en h1/h2 for å markere et ord med tusj.
   Fargevarianter: <em class="sage"> og <em class="blush">.
   ========================================================= */

:root {
  --bg: #fbfaf6;
  --card: #ffffff;
  --bg-soft: #f3f0e7;
  --line: #e4ded0;
  --ink: #1f201b;
  --ink-soft: #5d5a4c;
  --green: #4f6b2f;
  --red: #c4573a;

  /* Tusjfarger */
  --hl-yellow: #fbe38a;
  --hl-sage: #d3e3ad;
  --hl-blush: #f6cdb9;

  --radius: 22px;
  --maxw: 1080px;
  --sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181914;
    --card: #22241d;
    --bg-soft: #1e2019;
    --line: #34372b;
    --ink: #efebdf;
    --ink-soft: #b4af9e;
    --green: #a9c27a;
    --red: #e48a6d;
    /* Tusjen blir mørkere og dempet i mørk modus, så lys tekst fortsatt leses godt */
    --hl-yellow: #6e5f22;
    --hl-sage: #4a5a2e;
    --hl-blush: #6e4232;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 0.45em; }
h1 { font-size: clamp(2.6rem, 6.2vw, 5rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); }
h3 { font-size: 1.4rem; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { color: var(--red); }

/* ---------- Tusj ---------- */
h1 em, h2 em {
  --c: var(--hl-yellow);
  font-style: normal;
  position: relative;
  z-index: 0;
  white-space: nowrap;
}
h1 em::before, h2 em::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.12em; right: -0.12em; top: 52%; bottom: 4%;
  background: var(--c);
  border-radius: 0.3em 0.5em 0.25em 0.6em / 0.6em 0.3em 0.5em 0.3em;
  transform: rotate(-1.2deg) skewX(-6deg);
}
h1 em.sage, h2 em.sage { --c: var(--hl-sage); }
h1 em.blush, h2 em.blush { --c: var(--hl-blush); }

/* Rød ring rundt et ord */
.ring { position: relative; display: inline-block; }
.ring svg { position: absolute; left: -12%; top: -24%; width: 124%; height: 150%; pointer-events: none; overflow: visible; }
.ring path { stroke: var(--red); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 1em;
}
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo:hover { color: var(--ink); }
.logo-dot { width: 22px; height: 22px; border: 3px solid var(--green); border-radius: 50%; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; font-weight: 500; font-size: 0.97rem; border-radius: 999px; }
.nav a:hover { color: var(--red); }
.nav a[aria-current="page"] { background: var(--bg-soft); }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; }
.hero h1 { max-width: 15em; }
.blob { display: none; }

/* ---------- Knapper ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 24px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  text-decoration: none; font: inherit; font-weight: 600;
  border: 0; cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: var(--green); color: var(--bg); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--card); color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }

/* ---------- Seksjoner ---------- */
section { padding: 88px 0; }
main > section + section { border-top: 1px solid var(--line); }
.section-head { max-width: 44em; margin-bottom: 44px; }

.about { display: grid; grid-template-columns: 300px 1fr; gap: 64px; align-items: start; }
.portrait {
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #b4bf98, #5f6b3c);
  border-radius: 28px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; letter-spacing: 0.05em;
  overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding: 0; list-style: none; }
.facts li { padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 0.9rem; }

.certs { margin-top: 24px; }
.certs summary { cursor: pointer; font-weight: 600; color: var(--green); list-style: none; }
.certs summary::-webkit-details-marker { display: none; }
.certs summary::before { content: "+ "; }
.certs[open] summary::before { content: "– "; }
.certs ul { margin: 12px 0 0; padding-left: 1.2em; color: var(--ink-soft); font-size: 0.95rem; }
.certs li { margin-bottom: 4px; }

/* ---------- Kort ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card .icon { font-size: 1.4rem; margin-bottom: 14px; }
.card h3 { margin-bottom: 12px; }
.card p { color: var(--ink-soft); line-height: 1.6; }
.card p:last-child { margin-bottom: 0; }
.card .card-meta { font-size: 0.86rem; font-weight: 600; color: var(--green); }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -22px rgba(0, 0, 0, 0.35); }
a.card h3 { font-size: 1.5rem; }
a.card:hover h3 { color: var(--red); }
a.card .card-meta { font-weight: 400; color: var(--ink-soft); }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}

/* ---------- Filter i Lab ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.filters button {
  font: inherit; font-size: 0.92rem; font-weight: 500;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- Kontakt ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: start; }
form.contact-form { display: grid; gap: 16px; }
.contact-form label { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.contact-form input, .contact-form textarea {
  font: inherit; font-weight: 400;
  padding: 13px 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--hl-yellow) 60%, transparent);
}

/* ---------- Artikler ---------- */
.article { max-width: 740px; margin: 0 auto; padding: 64px 24px 96px; }
.article h1 { font-size: clamp(2.3rem, 5.4vw, 3.8rem); }
.article h2 { font-size: 1.75rem; letter-spacing: -0.025em; margin-top: 1.6em; }
.article .meta { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 40px; }
.article ul, .article ol { padding-left: 1.3em; }
.article li { margin-bottom: 0.4em; }
.back { display: inline-block; margin: 0 14px 28px 0; text-decoration: none; font-size: 0.95rem; color: var(--ink-soft); }

code { font-family: var(--mono); font-size: 0.86em; background: var(--bg-soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
pre {
  font-family: var(--mono); font-size: 0.86rem;
  background: #1f201b; color: #efebdf;
  padding: 22px; border-radius: 18px;
  overflow-x: auto; line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

blockquote {
  margin: 1.4em 0;
  padding: 16px 22px;
  border-left: 4px solid var(--hl-yellow);
  background: var(--card);
  border-radius: 0 16px 16px 0;
  color: var(--ink-soft);
}

.tabell { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 8px 0 20px; }
.tabell th, .tabell td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tabell th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.tabell td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Steg-for-steg-guide ---------- */
.tldr { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px; margin: 8px 0 44px; font-size: 0.95rem; }
ol.steps { list-style: none; counter-reset: steg; padding: 0; margin: 0; }
ol.steps > li { counter-increment: steg; position: relative; padding: 0 0 36px 64px; margin: 0; }
ol.steps > li::before {
  content: counter(steg);
  position: absolute; left: 0; top: 0;
  width: 42px; height: 42px; display: grid; place-items: center;
  font-weight: 700; font-size: 1.1rem;
  color: var(--ink); background: var(--hl-yellow);
  border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%;
}
ol.steps > li::after { content: ""; position: absolute; left: 20px; top: 52px; bottom: 8px; width: 2px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }
ol.steps > li > h2 { margin-top: 4px; font-size: 1.5rem; }
ol.steps blockquote { font-style: italic; }

/* ---------- Footer ---------- */
.site-footer { padding: 40px 0 56px; color: var(--ink-soft); font-size: 0.9rem; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Myk inn-animasjon ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { height: auto; padding-top: 12px; padding-bottom: 12px; flex-direction: column; align-items: flex-start; gap: 6px; }
  .nav a { padding: 4px 10px 4px 0; }
  .nav a[aria-current="page"] { background: none; color: var(--red); }
  .hero { padding: 48px 0 56px; }
  section { padding: 64px 0; }
  .about, .contact { grid-template-columns: 1fr; gap: 32px; }
  .portrait { max-width: 240px; }
  .article { padding: 40px 16px 72px; }
  ol.steps > li { padding-left: 52px; }
  ol.steps > li::before { width: 36px; height: 36px; font-size: 1rem; }
  ol.steps > li::after { left: 17px; top: 46px; }

  /* Lange markeringer kan brytes over flere linjer: da tegnes tusjen per linje */
  h1 em, h2 em {
    white-space: normal;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    background: linear-gradient(transparent 55%, var(--c) 55%, var(--c) 92%, transparent 92%);
  }
  h1 em::before, h2 em::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Logo (fra «FOSS Rådgivning – logo») ---------- */
:root { --logo-ring: #707070; --logo-bars: #4277bc; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --logo-ring: #9b9b9b; --logo-bars: #7aa3dc; }
}
.logo { display: inline-flex; flex-direction: column; align-items: stretch; gap: 1px; font-family: "Space Grotesk", var(--sans); color: var(--ink); line-height: 1; }
.logo-top { display: flex; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 30px; letter-spacing: 0.01em; }
.logo-o { width: 20px; height: 20px; margin: 0 1px; flex-shrink: 0; }
.logo-o .ring-o, .logo-o .dot { stroke: var(--logo-ring); fill: none; }
.logo-o .dot { fill: var(--logo-ring); stroke: none; }
.logo-o .bar { fill: var(--logo-bars); }
.logo-sub { display: flex; justify-content: space-between; font-weight: 500; font-size: 7.2px; }

/* ---------- Manuelt valgt mørk modus (knappen i headeren) ----------
   Samme farger som systemets mørke modus over. Holdes like! */
:root[data-theme="dark"] {
  --bg: #181914;
  --card: #22241d;
  --bg-soft: #1e2019;
  --line: #34372b;
  --ink: #efebdf;
  --ink-soft: #b4af9e;
  --green: #a9c27a;
  --red: #e48a6d;
  --hl-yellow: #6e5f22;
  --hl-sage: #4a5a2e;
  --hl-blush: #6e4232;
  --logo-ring: #9b9b9b;
  --logo-bars: #7aa3dc;
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Lys/mørk-knapp ---------- */
.header-right { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--bg-soft); color: var(--red); }
.theme-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
/* Vis måne i lys modus og sol i mørk modus */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

@media (max-width: 760px) {
  .header-right { width: 100%; justify-content: space-between; }
  .theme-toggle { width: 34px; height: 34px; }
}
