/* Colours: the default theme "papper" here, the others below. Text, muted text and links all reach
   at least 5:1 contrast on their background; the lighter palette colours are only used as
   surfaces (header, its top stripe, search highlight). */
:root {
    --paper: #faf7f1;
    --ink: #24201b;
    --muted: #6d655a;
    --rule: #e3dbcd;
    --accent: #7b4a22;
    --accent-dark: #57320f;
    --band: #faf7f1;
    --band-ink: #24201b;
    --band-muted: #6d655a;
    --stripe: transparent;
    --mark: #f5dd9b;
    --measure: 36rem;
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="terrakotta"] {
    --paper: #fcf9ea;
    --ink: #24201b;
    --muted: #6d6a61;
    --rule: #e3e5ce;
    --accent: #875b37;
    --accent-dark: #614228;
    --band: #dd965a;
    --band-ink: #24201b;
    --band-muted: #24201b;
    --stripe: #97a97a;
    --mark: #e9be94;
}

[data-theme="marin"] {
    --paper: #fff6dc;
    --ink: #24201b;
    --muted: #6e695d;
    --rule: #dce8e0;
    --accent: #3f5999;
    --accent-dark: #2d406e;
    --band: #3f5999;
    --band-ink: #fff6dc;
    --band-muted: #fff6dc;
    --stripe: #71bfeb;
    --mark: #ff94a6;
}

[data-theme="plommon"] {
    --paper: #fff5d9;
    --ink: #24201b;
    --muted: #6e685c;
    --rule: #efcdc1;
    --accent: #611b49;
    --accent-dark: #461335;
    --band: #611b49;
    --band-ink: #ffecb9;
    --band-muted: #ffecb9;
    --stripe: #bf547a;
    --mark: #ec9d9e;
}

[data-theme="grafit"] {
    --paper: #fdf2e5;
    --ink: #433939;
    --muted: #706562;
    --rule: #faccbb;
    --accent: #a7402b;
    --accent-dark: #782e1f;
    --band: #524646;
    --band-ink: #fdf2e5;
    --band-muted: #fdf2e5;
    --stripe: #ef5b3d;
    --mark: #f7b6a2;
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    line-height: 1.65;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

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

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Header and footer */

.site-header {
    position: relative;
    padding: 1.6rem 1rem 1.4rem;
    border-top: 5px solid var(--stripe);
    border-bottom: 1px solid var(--rule);
    background: var(--band);
    color: var(--band-ink);
    text-align: center;
}

.site-header a:focus-visible {
    outline-color: var(--band-ink);
}

.language-switch {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
}

.language-switch[hidden] {
    display: none;
}

.language-switch select {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.8rem;
    cursor: pointer;
}

.language-switch select:hover {
    border-color: var(--muted);
}

.site-title {
    color: var(--band-ink);
    font-size: 1.7rem;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.site-title:hover {
    color: var(--band-ink);
    text-decoration: underline;
}

.site-subtitle {
    margin: 0.15rem 0 0;
    color: var(--band-muted);
    font-style: italic;
}

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 1rem 2.5rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.site-footer a {
    color: inherit;
}

main {
    max-width: calc(var(--measure) + 2rem);
    margin: 0 auto;
    padding: 2rem 1rem 0;
}

/* Index */

.index-heading {
    margin: 0 0 1rem;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.article-list li {
    padding: 1.25rem 0 1.1rem;
    border-top: 1px solid var(--rule);
}

.article-list h3 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: normal;
    line-height: 1.3;
}

.article-list h3 a {
    color: var(--ink);
    text-decoration: none;
}

.article-list h3 a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin: 0 0 1.5rem;
    font-family: var(--sans);
    font-size: 0.9rem;
}

.category + .category {
    margin-top: 2.5rem;
}

.category-heading {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
    font-weight: normal;
    scroll-margin-top: 1rem;
}

.crumb-separator {
    margin: 0 0.5rem;
    color: var(--muted);
}

.article-list p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

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

/* Search */

.search {
    margin: 0 0 2rem;
}

.search-label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
}

.search-row {
    display: flex;
    gap: 0.5rem;
}

.search-box {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--muted);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.search-box::placeholder {
    color: var(--muted);
}

/* The "Rensa" button does this, larger. */
.search-box::-webkit-search-cancel-button {
    display: none;
}

.search-box:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.search-clear {
    padding: 0 1rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.85rem;
    cursor: pointer;
}

.search-clear:hover {
    border-color: var(--muted);
}

.search-clear[hidden] {
    display: none;
}

.search-status {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 0.85rem;
}

.search-status:empty {
    display: none;
}

.search-results {
    margin-top: 0.75rem;
}

.article-list .search-category {
    margin-bottom: 0.25rem;
    font-family: var(--sans);
    font-size: 0.8rem;
}

.search mark {
    padding: 0 0.1em;
    border-radius: 2px;
    background: var(--mark);
    color: var(--ink);
}

/* Article */

.crumbs {
    margin-bottom: 1.75rem;
    font-family: var(--sans);
    font-size: 0.85rem;
}

.article h1 {
    margin: 0 0 1.5rem;
    font-size: 2.1rem;
    font-weight: normal;
    line-height: 1.2;
}

.article h2 {
    margin: 2.2rem 0 0.6rem;
    font-size: 1.3rem;
    line-height: 1.3;
}

/* Exactly one empty line between paragraphs (1.65em is the line height), as in the editor. */
.article p {
    margin: 0 0 1.65em;
}

.article h1:not(:first-child) {
    margin-top: 2.5rem;
}

.quote {
    margin: 1.75rem 0;
    padding-left: 1.4rem;
    border-left: 3px solid var(--rule);
}

.quote p {
    margin: 0;
}

.quote p + p {
    margin-top: 1.65em;
}

.picture {
    margin: 2rem 0;
}

.picture a {
    display: block;
    cursor: zoom-in;
}

.picture img {
    display: block;
    max-width: 100%;
    max-height: 32rem;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgb(36 32 27 / 0.18);
}

.picture figcaption,
.article p.caption {
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.5;
    text-align: center;
}

.article-tools {
    margin-top: 2.5rem;
}

.print-button {
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.85rem;
    cursor: pointer;
}

.print-button:hover {
    border-color: var(--muted);
}

/* Enlarged image */

.lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(20 18 15 / 0.94);
    color: #f3eee6;
}

.lightbox[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.lightbox::backdrop {
    background: transparent;
}

.lightbox img {
    max-width: 94vw;
    max-height: 82vh;
    object-fit: contain;
}

.lightbox p {
    max-width: 40rem;
    margin: 0;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgb(243 238 230 / 0.4);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-family: var(--sans);
    font-size: 0.9rem;
    cursor: pointer;
}

@media (max-width: 600px) {
    html {
        font-size: 118.75%;
    }

    .language-switch {
        position: static;
        margin-bottom: 0.75rem;
    }

    main {
        padding: 1.5rem 16px 0;
    }

    .site-title {
        font-size: 1.45rem;
    }

    .article h1 {
        font-size: 1.75rem;
    }
}

@media print {
    html {
        font-size: 12pt;
    }

    body {
        background: #fff;
        color: #000;
    }

    /* Printers leave out backgrounds, so the header's light text would vanish on paper. */
    .site-header {
        padding: 0 0 0.5rem;
        border-top: 0;
        background: none;
        color: #000;
        text-align: left;
    }

    .site-title {
        color: #000;
        font-size: 1rem;
    }

    .site-subtitle,
    .language-switch,
    .search,
    .crumbs,
    .article-tools,
    .site-footer {
        display: none;
    }

    main {
        max-width: none;
        padding: 1rem 0 0;
    }

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

    .picture {
        break-inside: avoid;
    }

    .picture img {
        max-height: 12cm;
        box-shadow: none;
    }

    .article h2 {
        break-after: avoid;
    }
}
