/* Global layout */

body {
    max-width: 680px;
    margin: 60px auto;
    padding: 0 24px;
    font-family: 'Avenir Next', system-ui, sans-serif;
    font-size: 17px;
    line-height: 2;
    color: #222;
    background: #fff;
}

/* Navigation */

header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 48px;
}

/* Typography */

a {
    color: inherit;
    text-underline-offset: 3px;
}

h1, h2, h3 {
    line-height: 1.3;
}

main h1 {
    margin: 0 0 1.5rem;
}

pre {
    overflow-x: auto;
}

/* Article layout */

article {
    display: flow-root;
}

article h2,
article h3 {
    clear: both;
}

article h2,
article h3,
article h4 {
    scroll-margin-top: 2rem;
}

/* Publication dates */

.article-date {
    display: block;
    font-size: 0.8rem;
    font-weight: normal;
    color: #777;
}

article > .article-date {
    margin-bottom: 1.5rem;
}

li > .article-date {
    margin-bottom: 0.75rem;
}

/* Article descriptions */

.article-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
    margin: 0 0 1.25rem;
}

/* Images */

img {
    max-width: 100%;
    height: auto;
}

article img {
    display: block;
    margin: 1.5rem auto;
}

/* Figures */

article figure {
    margin: 2rem 0;
}

article figure img {
    width: 100%;
    margin: 0;
}

/* Figure captions */

article figcaption {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #777;
}

article figcaption p {
    margin: 0;
}

/* Floating figures */

article figure.left,
article figure.right,
article figure.alternate {
    clear: both;
    width: 45%;
}

article figure.left,
article figure.alternate:nth-of-type(odd) {
    float: left;
    margin: 0.4rem 1.5rem 1rem 0;
}

article figure.right,
article figure.alternate:nth-of-type(even) {
    float: right;
    margin: 0.4rem 0 1rem 1.5rem;
}

/* Full-width and centered figures */

article figure.full {
    clear: both;
    width: 100%;
}

article figure.center {
    clear: both;
    width: 65%;
    margin: 2rem auto;
}

/* Blockquotes */

article blockquote {
    display: flow-root;
    margin: 1.5rem 0;
    padding: 0.25rem 1.25rem;
    color: #555;
    font-style: italic;
    line-height: 1.5;
}

article blockquote p {
    margin: 0.5rem 0;
}

/* Quote attributions */

article blockquote p:last-child > strong:only-child {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    font-weight: normal;
    font-style: normal;
    color: #777;
    margin-top: 0.5em;
}

/* Footnote references */

article sup {
    font-size: 0.7em;
    line-height: 0;
    vertical-align: super;
}

article a.footnote-ref,
article a.footnote-backref {
    text-decoration: none;
}

article a.footnote-backref {
    margin-left: 0.25em;
}

/* Footnote section */

article .footnotes {
    clear: both;
    margin-top: 3rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #555;
}

article .footnotes::before {
    content: "Neðanmálsgreinar";
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

article .footnotes hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin-bottom: 1.5rem;
}

article .footnotes ol {
    padding-left: 1.5rem;
}

article .footnotes li {
    margin-bottom: 0.75rem;
}

article .footnotes p {
    margin: 0;
}

/* Table of contents */

.article-toc {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 2rem;
}

.article-toc h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.article-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.article-toc ul ul {
    padding-left: 1rem;
}

.article-toc li {
    margin: 0.5rem 0;
}

.article-toc a {
    text-decoration: none;
}

.article-toc a:hover {
    text-decoration: underline;
}

/* Responsive layout — mobile images */

@media (max-width: 600px) {
    article figure.left,
    article figure.right,
    article figure.center,
    article figure.alternate:nth-of-type(n) {
        float: none;
        width: 100%;
        margin: 1.5rem 0;
    }
}

/* Responsive layout — desktop sidebar */

@media (min-width: 1220px) {
    .article-layout:has(.article-toc) {
        display: grid;
        grid-template-columns: 200px minmax(0, 1fr);
        gap: 40px;
        margin-left: -240px;
    }

    .article-toc {
        position: sticky;
        top: 40px;
        align-self: start;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}