/* ============================================
   Tokens
   ============================================ */

:root {
    --font: sans-serif;
    --size: 14px;
    --leading: 1.4em;

    --ink: #000;
    --paper: #fff;
    --muted: #666;
    --rule: #ccc;
    --box-border: #aaa;
    --box-side: lavender;
    --box-notice: #f0f0f0;
    --link: blue;

    --line: 1px;
    --box-pad-y: 8px;
    --box-pad-x: 14px;
    --heading-gap: 8px;
    --notice-gap: 4px;
    --paragraph-gap: 1em;
    --hang: 12px;

    --column: 960px;
    --column-gap: 26px;
    --side-gap: 14px;
    --section-gap: 18px;
}

/* ============================================
   Base
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

ul,
ol {
    list-style-type: none;
}

/* One size for every piece of text: hierarchy comes from weight alone. */
html,
body,
h1, h2, h3, h4, h5, h6,
pre, code, kbd, samp, small, sub, sup {
    font-family: var(--font);
    font-size: var(--size);
    line-height: var(--leading);
}

button,
input,
select,
textarea {
    font: inherit;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
}

/* `body` is the page column: rheo emits the header, the page and the footer
   as its direct children, with no wrapper to hang the width on. */
body {
    color: var(--ink);
    background-color: var(--paper);
    max-width: var(--column);
    min-height: 100vh;
    margin: 0 auto;
    padding: 1em 20px;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

p {
    padding-top: var(--paragraph-gap);
}

p:first-of-type {
    padding-top: 0;
}

pre {
    white-space: pre-wrap;
}

/* ============================================
   Header and footer
   ============================================ */

.site-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5em 1em;
    padding-bottom: 1em;
    margin-bottom: 1em;
    border-bottom: var(--line) solid var(--rule);
}

.site-title a {
    color: var(--ink);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--box-pad-x);
}

.site-nav .current {
    color: var(--ink);
    font-weight: bold;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5em 1em;
    margin-top: auto;
    padding-top: 1em;
}

/* ============================================
   Components
   ============================================ */

.page-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: var(--column-gap);
    align-items: start;
}

.page-side {
    display: flex;
    flex-direction: column;
    gap: var(--side-gap);
}

/* When the main column opens on a section head, drop the side column by the
   head's height so the first boxes in both columns line up. */
.page-columns:has(> .page-main > .section-head:first-child) > .page-side {
    padding-top: calc(var(--leading) + var(--notice-gap));
}

@media (max-width: 700px) {
    .page-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-side,
    .page-columns:has(> .page-main > .section-head:first-child) > .page-side {
        order: -1;
        padding-top: 0;
    }
}

.notice,
.side-box {
    padding: var(--box-pad-y) var(--box-pad-x);
    border: var(--line) solid var(--box-border);
}

.notice {
    background-color: var(--box-notice);
}

.notice h4 {
    margin-bottom: var(--notice-gap);
}

.notice p {
    padding-top: 0;
}

.notice p + p {
    margin-top: var(--notice-gap);
}

.side-box {
    background-color: var(--box-side);
}

.side-box h4:not(:first-child) {
    margin-top: var(--heading-gap);
}

.entity {
    text-indent: calc(-1 * var(--hang));
    margin-left: var(--hang);
}

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

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    margin-top: var(--section-gap);
    margin-bottom: var(--notice-gap);
}

.section-head:first-child {
    margin-top: 0;
}

.section-head + p {
    padding-top: 0;
}

.listing {
    border: var(--line) solid var(--box-border);
}

.listing-item {
    padding: var(--box-pad-y) var(--box-pad-x);
}

.listing-item + .listing-item {
    border-top: var(--line) solid var(--rule);
}

.listing-meta {
    color: var(--muted);
}

.listing-item p {
    padding-top: 0;
}

/* Lists written in page content keep their markers; the base reset strips
   them for lists used as layout, such as the term grid. */
.page-main ol,
.page-main ul:not(.term-grid) {
    padding-top: var(--paragraph-gap);
    padding-left: 2em;
}

.page-main ol {
    list-style-type: decimal;
}

.page-main ul:not(.term-grid) {
    list-style-type: disc;
}

/* Cells share borders: the grid draws the top and left edges, each cell its
   right and bottom. */
.term-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: var(--line) solid var(--box-border);
    border-left: var(--line) solid var(--box-border);
}

.term {
    padding: var(--box-pad-y) var(--box-pad-x);
    border-right: var(--line) solid var(--box-border);
    border-bottom: var(--line) solid var(--box-border);
}

.term.in-flight {
    background-color: var(--box-notice);
}

.term.complete {
    background-color: var(--box-side);
}

@media (max-width: 700px) {
    .term-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================
   Rookery. Its stylesheet loads after this one and
   sets labels and tags as small as 0.57rem, so the single size is enforced.
   ============================================ */

body [data-rookery],
body [data-rookery] * {
    font-family: var(--font) !important;
    font-size: var(--size) !important;
    line-height: var(--leading) !important;
}
