body {
  padding: 0 12px;
  margin: 1rem auto 3rem;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  font-size: 1.1rem;
  max-width: 40em;
  -webkit-font-smoothing: antialiased;
  color: #111;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 600;
}

h2,
h3 {
  margin-top: 1.5em;
}

h1 {
  margin: 0.5rem 0 0.75rem;
  font-size: 2rem;
}

strong {
  font-weight: 600;
}

a {
  color: currentColor;
  text-underline-offset: 0.1lh;
}

a:hover {
  text-underline-offset: 0.15lh;
}

/* Visited articles in the list pages drop their underline so the unread ones
   stand out. Scoped to the article lists only — elsewhere (nav, error pages,
   article bodies) links must keep looking clickable. The color must be an
   opaque match for the background: browsers ignore the alpha channel in
   :visited styles, so transparent cannot be used. */
ul[role="list"] a:visited {
  text-decoration-color: white;
}

h1 a {
  text-decoration: none;
}

h1 a:hover {
  text-decoration: underline;
}

/* External link icon on article titles */
article h1 a::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
  transition: opacity 0.2s;
}

article h1 a:hover::after {
  opacity: 0.7;
}

@media (prefers-color-scheme: dark) {
  article h1 a::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  }
}

/* Section eyebrow. Sits directly above the article h1; the h1's own top
   margin provides the tight kicker gap. */
.section {
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  margin: 0;
}

/* Byline and dateline form one tight meta block under the title. The byline
   is dimmed; the dateline keeps full text colour since the timestamp is what
   gets glanced at. */
.authors {
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
}

/* Dateline (publisert / oppdatert) */
.dateline {
  font-size: 0.85rem;
  margin: 0 0 2rem;
}

.dateline::first-letter {
  text-transform: uppercase;
}

/* Lead paragraph */
.lead {
  font-size: 1.3rem;
  margin: 0 0 2rem;
}

/* Dim text */
.dim {
  color: #666;
}

/* Repel layout */
.repel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: var(--repel-vertical-alignment, center);
  gap: var(--gutter, 1rem);
}

/* Page count */
.page-count {
  min-width: 6ch;
  text-align: right;
}

/* Header navigation */
header nav {
  --repel-vertical-alignment: baseline;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 2.5rem;
}

/* Primary nav cluster (Dagleg / Live) and the right-side context slot. */
.nav-primary {
  display: flex;
  gap: 1.25rem;
}

.nav-context {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.nav-context a {
  color: inherit;
}

nav a {
  text-decoration: underline;
}

/* Active section in header nav: drop the underline and bump weight so the
   actionable inactive link is the underlined one and the current page reads
   as "you are here". */
header nav a[aria-current="page"] {
  text-decoration: none;
  font-weight: 600;
}

/* Grey dot after the Dagleg link when the edition on screen is not the
   newest — a quiet nudge that fresh content exists. */
.has-new::after {
  content: "";
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin-left: 0.35em;
  border-radius: 50%;
  background-color: #666;
  vertical-align: middle;
}

/* Screen-reader-only text, e.g. the label behind the .has-new dot. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Footer navigation */
footer nav {
  margin: 3rem 0 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid #e0e0e0;
}

footer nav a {
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  transition: background-color 0.2s;
  background-color: #f5f5f5;
  color: #333;
}

footer nav a:hover {
  background-color: #e0e0e0;
  text-decoration: none;
}

/* List pages */
ul[role="list"] {
  list-style: none;
  margin-block: 0;
  padding: 0;
}

ul[role="list"] li + li {
  margin-top: 1em;
}

li:empty {
  display: none;
}

/* The only button on the front pages is the shortcuts-close one; just
   normalise the font away from the browser default. */
button {
  font: inherit;
  cursor: pointer;
}

/* Keyboard shortcuts overlay */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.shortcuts-dialog {
  background: #fff;
  color: #111;
  padding: 1.5rem 2rem;
  border-radius: 8px;
  max-width: 400px;
  position: relative;
}

.shortcuts-dialog h2 {
  margin: 0 2rem 1rem 0;
}

.shortcuts-dialog dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.shortcuts-dialog dt {
  font-family: monospace;
  background: #eee;
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

.shortcuts-dialog dd {
  margin: 0;
}

.shortcuts-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2em 0.4em;
  line-height: 1;
}

.shortcuts-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.shortcuts-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #888;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    color: unset;
  }

  ul[role="list"] a:visited {
    text-decoration-color: black;
  }

  .dim {
    color: #999;
  }

  .has-new::after {
    background-color: #999;
  }

  header nav,
  footer nav {
    border-color: #333;
  }

  footer nav a {
    background-color: #2a2a2a;
    color: #e0e0e0;
  }

  footer nav a:hover {
    background-color: #333;
  }

  .shortcuts-dialog {
    background: #222;
    color: #eee;
  }

  .shortcuts-dialog dt {
    background: #444;
  }

  .shortcuts-close:hover {
    background: rgba(255, 255, 255, 0.15);
  }
}
