:root {
  color-scheme: light;
  --background: #fbfbfa;
  --surface: #f2f3f2;
  --text: #17191c;
  --muted: #5c636c;
  --border: #dfe1e3;
  --accent: #0a5fb4;
  --accent-soft: #e4eff9;
  --code-background: #f2f3f4;
  --card: #ffffff;
  --card-border: #d3d7da;
  --measure: 44rem;
  --brand-gradient: linear-gradient(90deg, #0f6b3c, #0b5cad 30%, #cf5bab 70%, #cf5f35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #121417;
    --surface: #1b1e22;
    --text: #e9ebee;
    --muted: #a0a7b0;
    --border: #2d3238;
    --accent: #84bdf5;
    --accent-soft: #1b2c3e;
    --code-background: #1b1e22;
  --card: #1b1e22;
  --card-border: #3f454d;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #121417;
  --surface: #1b1e22;
  --text: #e9ebee;
  --muted: #a0a7b0;
  --border: #2d3238;
  --accent: #84bdf5;
  --accent-soft: #1b2c3e;
  --code-background: #1b1e22;
  --card: #1b1e22;
  --card-border: #3f454d;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 1.0625rem/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--background);
}

.skip-link:focus {
  top: 0.5rem;
}

.muted {
  color: var(--muted);
}

/* Topp og bunn */

.site-header,
.site-footer {
  border: 0 solid;
  border-image: var(--brand-gradient) 1;
}

.site-header {
  border-bottom-width: 2px;
}

.site-footer {
  border-top-width: 2px;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0.85rem 1rem;
}

.site-name {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-search {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 9rem;
}

.site-search input {
  width: 100%;
  max-width: 14rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

/* Forsiden og lister */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}

.hero-art {
  position: absolute;
  inset: 0;
  overflow: visible;
  width: 100%;
  height: 100%;
}

.hero-nodes circle {
  fill: var(--surface);
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  max-width: 62rem;
  min-height: 10rem;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.hero-inner h1 {
  margin: 0 0 0.35rem;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero-inner h1 a {
  color: var(--text);
  text-decoration: none;
}

.hero-inner p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
  text-wrap: balance;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.chip {
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
}

.chip span {
  color: var(--muted);
}

.chip:hover {
  border-color: var(--accent);
}

.post-summary {
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem 1.4rem;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  transition: border-color 0.15s;
}

.post-summary:hover {
  border-color: var(--accent);
}

.post-summary h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.post-summary h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-summary h2 a:hover {
  color: var(--accent);
}

.post-summary p {
  margin: 0;
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta a {
  color: inherit;
  text-decoration: none;
}

.meta a:hover {
  color: var(--accent);
}

.series-badge {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.1rem 0.6rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.pagination {
  display: flex;
  justify-content: space-between;
  padding-top: 0.75rem;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

.lead {
  margin: -0.75rem 0 1.5rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.list-row small {
  color: var(--muted);
  font-weight: 400;
}

.list-row:hover span {
  color: var(--accent);
}

.series-card {
  display: block;
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.series-card:hover {
  border-color: var(--accent);
}

.series-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.series-card p {
  margin: 0.3rem 0 0.5rem;
  color: var(--muted);
}

.series-card small {
  color: var(--muted);
}

.parts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.parts li {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.part-number {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 2rem;
  text-align: center;
}

.parts h2 {
  margin: 0 0 0.15rem;
  font-size: 1.2rem;
  line-height: 1.35;
}

.parts h2 a {
  color: var(--text);
  text-decoration: none;
}

.parts h2 a:hover {
  color: var(--accent);
}

.parts p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.search-large {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-large input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-large button {
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--background);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Innlegg */

.post-header h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.post-header {
  margin-bottom: 2rem;
}

.series-box {
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.95rem;
}

.series-box summary {
  cursor: pointer;
}

.series-part {
  margin-right: 0.5rem;
  color: var(--accent);
  font-weight: 700;
}

.series-title {
  font-weight: 600;
}

.series-box ol {
  margin: 0.75rem 0 0.5rem;
  padding-left: 1.5rem;
}

.series-all {
  font-size: 0.88rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.4rem 0 0.7rem;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.35;
}

.prose li + li {
  margin-top: 0.25rem;
}

.prose img,
.prose video {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.prose figure {
  margin: 1.75rem 0;
}

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.prose .video {
  margin: 1.75rem 0;
}

.prose .video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 6px;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--surface);
}

.prose code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
}

.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--code-background);
  overflow-wrap: anywhere;
}

.prose pre,
.code-block pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-background);
  font-size: 0.95rem;
  line-height: 1.55;
}

.prose > pre,
.code-block {
  margin: 1.5rem 0;
}

.code-block {
  position: relative;
}

.code-block pre {
  padding-right: 4.5rem;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--background);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.copy-button:hover {
  color: var(--text);
}

.code-block.collapsed pre {
  overflow-y: hidden;
  max-height: 24rem;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.code-block.collapsed::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 2.35rem;
  height: 4rem;
  background: linear-gradient(transparent, var(--code-background));
  pointer-events: none;
}

.expand-button {
  display: block;
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.code-block:not(.collapsed) .expand-button {
  margin-top: 0.4rem;
  border-top: 1px solid var(--border);
  border-radius: 8px;
}

.part-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 3rem;
}

.part-nav a {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.part-nav a:hover {
  border-color: var(--accent);
}

.part-nav small {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-weight: 400;
}

.part-nav .next {
  grid-column: 2;
  text-align: right;
}

@media (max-width: 640px) {
  .site-name {
    flex: 1;
  }

  .site-nav {
    order: 3;
    width: 100%;
  }

  .site-search {
    order: 4;
    flex-basis: 100%;
  }

  .site-search input {
    max-width: none;
  }

  .content {
    padding-top: 1.75rem;
  }

  /* Bare skyen får plass ved siden av teksten, så tegningen forstørres og forskyves mot høyre. */
  .hero-art {
    left: auto;
    right: 0;
    width: 140vw;
  }

  .hero-left {
    display: none;
  }

  .hero-inner {
    min-height: 8.5rem;
    padding: 1rem;
  }

  .hero-inner h1 {
    margin-bottom: 0.2rem;
    font-size: clamp(1.25rem, 6vw, 1.9rem);
  }

  .hero-inner p {
    max-width: 40vw;
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .site-nav:first-child {
    order: 0;
    flex: 1;
    width: auto;
  }

  .post-summary,
  .series-card {
    padding: 1rem 1.1rem 1.15rem;
  }

  .part-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .part-nav .next {
    grid-column: 1;
  }
}
