:root {
  --paper: #eef2f3;
  --card: #fafbfb;
  --ink: #4a1622;
  --muted: #7d5760;
  --line: #ccd6da;
  --accent: #2e6a6d;
  --amber: #96590b;
  --amber-bg: #f6eddd;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --slab: "Zilla Slab", Georgia, "Times New Roman", serif;
  --wrap: min(100% - 2.5rem, 64rem);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 clamp(1rem, 0.97rem + 0.15vw, 1.0625rem)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--slab); font-weight: 600; line-height: 1.2; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
.mono { font-family: var(--mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 2;
}
.skip:focus { left: 1rem; }

/* ---------- seksjonsmeny ---------- */

html { scroll-behavior: smooth; }
[data-spy] { scroll-margin-top: 4.5rem; }

.rail {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.rail ul { display: flex; gap: 0.25rem; padding: 0.6rem 1.25rem; }
.rail a {
  display: block;
  white-space: nowrap;
  font: 400 0.72rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 0.6rem 0.7rem;
}
.rail a:hover { color: var(--ink); }
.rail a[aria-current] { color: var(--accent); }
.rail__no { display: none; }

@media (min-width: 62rem) {
  body { padding-left: 13rem; }
  [data-spy] { scroll-margin-top: 2rem; }

  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: 13rem;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.75rem;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    overflow: visible;
  }
  .rail ul { flex-direction: column; gap: 0.1rem; margin: auto 0; padding: 0; }
  .rail a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0;
    transition: color 0.15s;
  }
  .rail__no { display: inline; color: var(--line); transition: color 0.15s; }
  .rail a:hover .rail__no { color: var(--muted); }
  .rail a[aria-current] .rail__no { color: var(--accent); }
}

/* ---------- header / journalforside ---------- */

.record {
  width: var(--wrap);
  margin: 0 auto;
  padding: clamp(3rem, 9vw, 6rem) 0 2.5rem;
  border-bottom: 3px double var(--line);
}

.stamp {
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 1.5rem;
}

.record h1 {
  font-size: clamp(2.75rem, 8vw, 4.75rem);
  letter-spacing: -0.02em;
}

.record__role {
  font: 500 clamp(1.05rem, 2.5vw, 1.35rem)/1.4 var(--sans);
  color: var(--accent);
  padding-top: 0.35rem;
}

/* Portrettet er festet som et vedlegg i journalen — ramme, ikke rundt ikon. */
.record__top {
  display: grid;
  gap: 2rem;
  align-items: end;
}

.portrait {
  display: block;
  width: 11rem;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.4rem;
  filter: saturate(0.92);
}

@media (min-width: 46rem) {
  .record__top { grid-template-columns: minmax(0, 1fr) auto; gap: 2.5rem; }
  .portrait { width: 12.5rem; }
}

.intro {
  max-width: 46ch;
  margin-top: 2.5rem;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  color: #552430;
}

/* ---------- seksjoner ---------- */

main { width: var(--wrap); margin: 0 auto; }
section { padding: clamp(3rem, 7vw, 4.5rem) 0; border-bottom: 1px solid var(--line); }

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.75rem;
}
.sec-head h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
.sec-no {
  font: 400 0.8em/1 var(--mono);
  color: var(--accent);
  margin-right: 0.6rem;
}
.sec-note { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- filtre ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.filter {
  font: 400 0.75rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.filter:hover { color: var(--ink); border-color: var(--accent); }
.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- loggoppføringer ---------- */

.entry {
  display: grid;
  grid-template-areas: "time status" "body body";
  grid-template-columns: 1fr auto;
  gap: 0.6rem 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.entry:last-child { border-bottom: 1px solid var(--line); }

.entry__time { grid-area: time; font-size: 0.85rem; color: var(--accent); padding-top: 0.15rem; }
.entry__body { grid-area: body; }
.entry__status { grid-area: status; }

.entry h3 { font-size: 1.2rem; }
.entry__org {
  display: block;
  font: 400 0.85rem/1.4 var(--mono);
  color: var(--muted);
  padding-top: 0.3rem;
}
.entry__body p { color: #63313d; padding-top: 0.6rem; max-width: 62ch; }

.badge {
  display: inline-block;
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid #e3d3b8;
  padding: 0.4rem 0.55rem;
  white-space: nowrap;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-top: 0.85rem; }
.tags li {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.28rem 0.5rem;
}

/* ---------- prosjekter ---------- */

.exhibits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}
.exhibit {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.5rem;
  transition: border-color 0.15s;
}
.exhibit:hover { border-color: var(--accent); }
/* Hele kortet er klikkbart, men lenka sitter semantisk på tittelen. */
.exhibit h3 a { color: inherit; text-decoration: none; }
.exhibit h3 a::after { content: ""; position: absolute; inset: 0; }
.exhibit:hover h3 a { color: var(--accent); text-decoration: underline; }
.exhibit:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.exhibit h3 a:focus-visible { outline: none; }
.exhibit__id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.exhibit h3 { font-size: 1.15rem; padding-top: 0.75rem; }
.exhibit__org { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 0.3rem; }
.exhibit > p:nth-of-type(3) { padding-top: 0.75rem; color: #63313d; font-size: 0.95rem; }
.exhibit__repo {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 1rem;
}
.exhibit:hover .exhibit__repo { color: var(--accent); }
/* Demo-lenka må ligge over kortets klikkoverlegg for å kunne treffes. */
.exhibit__demo {
  position: relative;
  z-index: 1;
  float: right;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.exhibit__demo:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- ferdigheter ---------- */

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.75rem;
  margin: 0;
}
.skills dt {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
}
.skills dd { margin: 0; }
.skills .tags { padding-top: 0.75rem; }

/* ---------- utenom ---------- */

.utenom__note {
  max-width: 46ch;
  margin-bottom: 1.75rem;
  color: #63313d;
}

/* ---------- kontakt ---------- */

footer {
  width: var(--wrap);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 4.5rem) 0 4rem;
}
.contact { display: grid; gap: 0.85rem; max-width: 34rem; }
.contact li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
}
.contact span {
  flex: 0 0 5.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact a { font-size: 1.05rem; overflow-wrap: anywhere; }
.colofon { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); padding-top: 2.5rem; }

[hidden] { display: none !important; }

/* ---------- responsivt ---------- */

@media (min-width: 46rem) {
  .entry {
    grid-template-areas: "time body status";
    grid-template-columns: 9.5rem minmax(0, 1fr) auto;
    align-items: start;
    padding: 1.75rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  .skip, .rail, .filters, .sec-note { display: none; }
  body { padding-left: 0; }
  .exhibit, .badge, .tags li { background: none; }
  .portrait { width: 8rem; }
  section, .entry { break-inside: avoid; }
}
