/* Colors follow the reader's system light/dark setting, unless they pick
   one with the theme switcher in the footer (which sets data-theme). */

:root {
    color-scheme: light dark;
    --bg: light-dark(#fff, #222);
    --text: light-dark(#333, #ddd);
    --bright: light-dark(#111, #fff);
    --muted: light-dark(#777, #999);
    --rule: light-dark(#777, #999);
    --code-bg: light-dark(#f5f5f3, #2d2d2d);
    --link: light-dark(#2e6b34, #8cc98f);
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

html {
    font-size: 112.5%;
}

body {
    font-family: 'PT Serif', Georgia, serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
}

.page-width {
    width: min(700px, 100% - 2rem);
    margin: 0 auto;
}

/* Header: same on every page. */

#header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1.5rem;
    padding-top: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

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

#header a:hover {
    text-decoration: underline;
}

#site-name {
    font-size: 1.25rem;
    color: var(--bright) !important;
}

/* The dots between nav links are muted; the links themselves are not. */
#header nav {
    color: var(--muted);
}

#header nav a {
    color: var(--text);
}

#header nav .sep {
    margin: 0 0.5em;
}

#container {
    padding-top: 2rem;
    padding-bottom: 1rem;
}

/* Footer */

#footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.3rem 1.5rem;
    margin-top: 3rem;
    padding-top: 0.75rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--rule);
    font-size: 0.85rem;
    color: var(--muted);
}

#footer p {
    margin: 0;
}

#footer a {
    color: inherit;
    text-decoration-color: var(--muted);
}

#footer a:hover {
    color: var(--bright);
}

/* Text */

/* Vertical spacing uses one unit (1rem): text blocks, including headings,
   are separated by 1rem, list items by 0.5rem, and headings get an extra
   1rem above them to mark the start of a section. */

h1, h2, h3 {
    font-weight: normal;
    line-height: 1.25;
}

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

h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

h3 {
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
}

p#date {
    color: var(--muted);
    margin: -0.5rem 0 2rem;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-color: var(--link);
}

h1, h2, h3 {
    color: var(--bright);
}

p, ul, ol, pre {
    margin: 0 0 1rem;
}

li p {
    margin: 0;
}

/* A paragraph introducing a list sits close to it. */
p:has(+ ul, + ol) {
    margin-bottom: 0.5rem;
}

ul {
    padding-left: 1.5em;
}

li {
    margin: 0.5rem 0;
}

p img {
    width: 100%;
    border-radius: 4px;
}

/* Code */

code, pre {
    font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

code {
    background-color: var(--code-bg);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

pre {
    background-color: var(--code-bg);
    border-radius: 4px;
    padding: 0.8rem 1rem;
    overflow: auto;
    line-height: 1.5;
}

pre code {
    background: none;
    padding: 0;
    font-size: 1em;
}

/* Journal entry list */

#journal-heading {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

#entry-list {
    list-style: none;
    padding: 0;
}

#entry-list li {
    display: flex;
    gap: 1.5rem;
    margin: 0.5em 0;
}

#entry-list .entry-date {
    flex: 0 0 5.5rem;
    white-space: nowrap;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
    #entry-list li {
        flex-direction: column;
        gap: 0;
        margin: 0 0 1em;
    }

    #entry-list .entry-date {
        flex-basis: auto;
        font-size: 0.85rem;
    }
}

/* Bookmarks */

.bookmarks li {
    margin: 0.4em 0;
}

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

/* Theme switcher */

#theme-switcher {
    white-space: nowrap;
}

#theme-switcher button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

#theme-switcher button:hover {
    text-decoration: underline;
}

#theme-switcher button[aria-pressed="true"] {
    color: var(--bright);
    text-decoration: underline;
    text-decoration-color: var(--muted);
    text-underline-offset: 3px;
}

/* Node status pages (a.jamesfennell.dev etc.); see node/README.md. */

.node-table {
    border-collapse: collapse;
    margin: 0 0 1rem;
}

.node-table th,
.node-table td {
    text-align: left;
    vertical-align: baseline;
    padding: 0.35rem 1rem 0.35rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--rule) 35%, transparent);
}

.node-table th:last-child,
.node-table td:last-child {
    padding-right: 0;
}

.node-table th {
    font-weight: normal;
    color: var(--muted);
    white-space: nowrap;
}

.node-table thead th {
    font-size: 0.85rem;
    border-bottom-color: var(--rule);
}

.node-table .mono {
    font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.85em;
    white-space: nowrap;
}

/* Columns of icon links, e.g. the GitHub mark linking to the source. */
.node-table .icon {
    text-align: center;
    white-space: nowrap;
}

.node-table .icon a {
    display: inline-block;
    color: var(--bright);
    text-decoration: none;
}

.node-table .icon svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

@media (max-width: 560px) {
    .node-table .mono {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
