/* Spacing is margin-driven: the HTML's layout <br>s are neutralized below. */

:root {
    color-scheme: light dark;
    --text: #1c1c1c;
    --muted: #6c6c6c;
    --link: #2456a4;
    --rule: #d9d9d9;
    --bg: #fffdf9;
    --north-carolina: #7d9f7d;
    --san-francisco: #c58f5c;
    --los-angeles: #b47f97;
    --peninsula: #7392b8;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e6e3de;
        --muted: #9d9d9d;
        --link: #8ab4f8;
        --rule: #3a3a3a;
        --bg: #171717;
    }
}

html {
    background: var(--bg);
}

body {
    max-width: 44rem;
    margin: 0 auto;
    padding: 3.75rem 1.5rem 4rem;
    font-family: Charter, 'Bitstream Charter', Georgia, 'Times New Roman', serif;
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--text);
}

.header {
    text-align: center;
}

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

.summary {
    margin: 0;
    text-wrap: balance;
}

.links {
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    text-wrap: balance;
}

.links li {
    display: inline;
    white-space: nowrap;
}

.links li:not(:last-child)::after {
    content: "\00b7";
    margin: 0 0.5em;
    color: var(--muted);
}

h2 {
    margin: 2.2rem 0 0.9rem;
    padding-bottom: 0.25rem;
    font-size: 1.35rem;
    border-bottom: 1px solid var(--rule);
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.timeline {
    margin-top: 3.2rem;
}

.timeline br {
    display: none;
}

.employment {
    margin-bottom: 1.6rem;
}

.timeline h2 {
    margin: 0 0 0.4rem;
    padding: 0;
    border: 0;
    font-size: 1.25rem;
}

/* the organization's own site as archived during the period */
.era {
    margin-bottom: 0.4rem;
    font-size: 0.9em;
    color: var(--muted);
}

/* a company continuing an employment lineage within the same block */
.role + h2.company {
    margin-top: 1.1rem;
}

.role {
    margin-bottom: 0.8rem;
}

.role:last-child {
    margin-bottom: 0;
}

span.title {
    font-style: italic;
}

span.date {
    color: var(--muted);
}

ul {
    margin: 0.4rem 0 0;
    padding-left: 1.4rem;
}

li {
    margin: 0.2rem 0;
}

.enrollment {
    margin-bottom: 1.6rem;
}

details.coursework {
    margin-top: 0.6rem;
}

details.coursework summary {
    color: var(--muted);
    cursor: pointer;
}

details.coursework h3 {
    margin: 0.8rem 0 0;
    font-size: 1em;
}

.project {
    margin-bottom: 1.6rem;
}

/* where I was living: a bar in the right margin, never shown in the text flow */
aside.residence {
    display: none;
}

/* An unchecked kind is emptied, not removed, so a residence marker inside it keeps its place.
   The contents list carries the same classes, so its items follow. */
body:has(input[name="employment"]:not(:checked)) .employment:not(.consulting),
body:has(input[name="consulting"]:not(:checked)) .consulting,
body:has(input[name="education"]:not(:checked)) .enrollment,
body:has(input[name="projects"]:not(:checked)) .project {
    margin: 0;

    > :not(aside) {
        display: none;
    }
}

nav.toc {
    display: none;
}

/* shown only where the margin beside the 44rem column can hold it */
@media screen and (min-width: 78rem) {
    nav.toc {
        display: block;
        position: fixed;
        top: 3.75rem;
        left: calc(50% - 38rem);
        width: 13rem;
        max-height: calc(100vh - 6.25rem);
        overflow-y: auto;
        font-size: 0.85rem;
        line-height: 1.35;
    }

    nav.toc h2 {
        margin: 0 0 0.5rem;
        padding: 0;
        border: 0;
        font-size: 0.85rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--muted);
    }

    fieldset.filter {
        margin: 0 0 0.8rem;
        padding: 0;
        border: 0;
        color: var(--muted);
    }

    fieldset.filter label {
        display: block;
    }

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

    nav.toc li {
        margin: 0.35rem 0;
    }

    nav.toc a {
        color: var(--muted);
        text-decoration: none;
    }

    nav.toc a:hover {
        color: var(--text);
    }
}

/* the bar's height is set by the script in the page, from one marker to the next */
@media screen and (min-width: 62rem) {
    aside.residence {
        display: block;
        position: absolute;
        left: calc(50% + 22.75rem);
        width: 6.5rem;
        overflow: clip;
        box-sizing: border-box;
        padding-left: 0.9rem;
        font-size: 0.8rem;
        line-height: 1.35;
        color: var(--muted);
    }

    aside.residence::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0.8rem;
        width: 0.4rem;
    }

    aside.residence.north-carolina::before {
        background: var(--north-carolina);
    }

    aside.residence.san-francisco::before {
        background: var(--san-francisco);
    }

    aside.residence.los-angeles::before {
        background: var(--los-angeles);
    }

    aside.residence.peninsula::before {
        background: var(--peninsula);
    }

    aside.residence p {
        position: sticky;
        top: 1rem;
        margin: 0;
    }

    aside.residence span {
        display: block;
    }
}

@media print {
    html {
        background: #fff;
    }

    body {
        max-width: none;
        padding: 0;
        font-size: 10.5pt;
        color: #000;
    }

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

    h2 {
        break-after: avoid;
    }

    .role {
        break-inside: avoid;
    }

    details.coursework {
        display: none;
    }
}
