/* Carried over from the original jemdoc stylesheet; layout rebuilt with flexbox. */

:root {
    --heading: #003366;
    --text: black;
    --rule: #bbbbbb;
    --current: #023689;
    --bg: white;
    --dot: #d4d4d4;
}

/* Dark theme: follows the OS unless the toggle has picked light explicitly. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --heading: #8fb8e8;
        --text: #e2e2e2;
        --rule: #555555;
        --current: #8fb8e8;
        --bg: #16181c;
        --dot: #33363d;
    }
}

:root[data-theme="dark"] {
    --heading: #8fb8e8;
    --text: #e2e2e2;
    --rule: #555555;
    --current: #8fb8e8;
    --bg: #16181c;
    --dot: #33363d;
}

html {
    background-color: var(--bg);
    background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
    background-size: 18px 18px;
    background-attachment: fixed;
}

body {
    font: 80% Verdana, Geneva, sans-serif;
    line-height: 1.5em;
    color: var(--text);
    margin: 0 0 2em;
}

.layout {
    margin: 1em 1em 0 2em;
}

/* Theme toggle: pinned to the bottom-left corner, under the menu column. */
.menu button {
    position: fixed;
    left: 1em;
    bottom: 1em;
    font: inherit;
    font-size: 90%;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 1px 8px;
    cursor: pointer;
}

a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
}

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

h1 { font-size: 150%; margin-top: 0.6em; }
h2 { font-size: 115%; margin-top: 1.5em; }
h3 { font-size: 100%; margin-top: 1.5em; }

p {
    margin: 0 0 1.2em;
}

li {
    margin-bottom: 0.8em;
}

/* Layout: right-aligned menu beside a 600px content column. */
.layout {
    display: flex;
    align-items: flex-start;
}

.menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 3em 20px 0;
    white-space: nowrap;
}

.menu a {
    border-bottom: 1px solid gray;
}

.menu a.current {
    color: var(--current);
}

.content {
    padding: 1em 0 0 25px;
    width: 600px;
    max-width: 100%;
}

.profile {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 1em;
}

.profile img {
    flex: none;
    margin: 2px;
}

.profile p {
    margin-bottom: 1em;
}

/* Narrow screens: menu above content, photo above contact details. */
@media (max-width: 700px) {
    .layout {
        display: block;
        margin: 1em 16px 0;
    }

    .menu {
        flex-direction: row;
        gap: 1em;
        align-items: center;
        padding: 0.5em 0 0;
    }

    /* A fixed corner button would cover body text on a phone; keep it in the menu row. */
    .menu button {
        position: static;
    }

    .content {
        padding-left: 0;
        width: auto;
    }

    .profile {
        display: block;
    }

    .profile img {
        max-width: 100%;
        height: auto;
        margin-bottom: 1em;
    }
}
