/* Fonts */
@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap");

/* Definitions */
:root {
    /* Colors */
    --gray-faint: #F0F0F0;
    --gray-light: #E8E8E8;
    --gray-dark: #D8D8D8;
    --color-warning: #800000;

    /* Stamp colors */
    --stamp-blue-dark: #1B2A83;
    --stamp-blue-light: #BABDD8;
    --stamp-brown-dark: #5F483C;
    --stamp-brown-light: #CEC7C3;
    --stamp-green-dark: #7F9971;
    --stamp-green-light: #A7E0A3;
    --stamp-orange-dark: #AD7353;
    --stamp-orange-light: #E5D4CB;
    --stamp-purple-dark: #7D6E87;
    --stamp-purple-light: #D6D2DA;
    --stamp-red-dark: #8B000F;
    --stamp-red-light: #DAB3B7;

    /* Page size */
    --width-page: 60rem;

    /* Borders */
    --border-thin: 1px;
    --border-medium: 2px;
    --border-heavy: 5px;

    /* Font sizings */
    --size-body: large;
    --size-code: 80%;
    --size-subtitle: x-large;

    /* Spacings */
    --spacing-none: 0px;
    --spacing-small: 0.25rem;
    --spacing-medium: 0.5rem;
    --spacing-large: 1rem;
    --spacing-large-negative: -1.1rem;

    /* Image properties */
    --splash-width: 80%;
}

/* Small screen: display rows with one column */
@media screen {
    .row {
	width: 100%
    }
}

/* Wide screen: display rows as rows */
@media screen and (min-width: 60rem) {
    .row {
	display: flex;
	flex-flow: row wrap;
    }
}

/* Always display as row */
.row-always {
    width: 100%;
    display: flex;
    flex-flow: row wrap;
}

/* Flex grid */
.row > * {
  flex: 1; /* allow children to grow when space available */
}
.col-1 { flex-basis: calc(100% * 1/12); }
.col-2 { flex-basis: calc(100% * 2/12); }
.col-3 { flex-basis: calc(100% * 3/12); }
.col-4 { flex-basis: calc(100% * 4/12); }
.col-5 { flex-basis: calc(100% * 5/12); }
.col-6 { flex-basis: calc(100% * 6/12); }
.col-7 { flex-basis: calc(100% * 7/12); }
.col-8 { flex-basis: calc(100% * 8/12); }
.col-9 { flex-basis: calc(100% * 9/12); }
.col-10 { flex-basis: calc(100% * 10/12); }
.col-11 { flex-basis: calc(100% * 11/12); }
.col-12 { flex-basis: calc(100% * 12/12); }

/* Generic positioning */
.left {
    text-align: left;
}
.right {
    text-align: right;
}
.center {
    text-align: center;
}

/* Undecorated navigation link */
a.undecorated {
    text-decoration: none;
}

/* Overall document body */
body {
    font-size: var(--size-body);
    max-width: var(--width-page);
}

/* Caption on table */
caption {
    text-align: center;
    text-wrap-mode: nowrap;
}

/* Citations */
cite {
    font-style: italic;
}

/* Code fragments */
code {
    font-family: "Source Code Pro", monospace;
    font-size: var(--size-code);
}

/* Add space below definitions in definition list. */
dd {
    margin-bottom: var(--spacing-medium);
}
dd:last-of-type {
    margin-bottom: 0px;
}

/* Callouts */
div.callout {
    background-color: var(--gray-faint);
}

/* Generic output */
div[class*='language'] {
    border-left: solid var(--border-heavy);
    border-top: solid var(--border-thin);
    border-bottom: solid var(--border-thin);
    border-right: 0px;
    padding-left: var(--border-heavy);
}
div.highlight {
    background-color: transparent;
}
div[class*='language'] pre {
    margin-top: var(--border-heavy);
    margin-bottom: var(--border-heavy);
}

/* Data files */
div.language-csv,
div.language-json,
div.language-md,
div.language-toml,
div.language-yml {
    border-color: var(--stamp-orange-light);
}

/* JavaScript */
div.language-js {
    border-color: var(--stamp-blue-light);
}

/* Output */
div.language-out {
    border-color: var(--stamp-brown-light);
}

/* Python */
div.language-py {
    border-color: var(--stamp-blue-light);
}

/* Shell */
div.language-sh {
    border-color: var(--stamp-green-light);
}

/* SQL */
div.language-sql {
    border-color: var(--stamp-red-light);
}

/* Transcripts */
div.language-text {
    border-color: var(--stamp-purple-light);
}

/* Bibliography key definitions */
dl.bibliography dt {
    font-weight: bold;
}

/* Glossary term definitions */
dl.glossary dt {
    font-weight: bold;
}

/* Caption on figure */
figcaption {
    text-align: center;
}

/* Figures */
figure {
    text-align: center;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
}

/* Page footer */
footer {
    border-top: solid var(--gray-light) var(--border-medium);
    padding-top: var(--spacing-small);
    text-align: center;
}

/* Level-1 heading */
h1 {
    text-align: center;
    margin-top: var(--border-heavy);
    margin-bottom: var(--border-heavy);
}

/* Entire page */
html {
    font-family: "Atkinson Hyperlegible", sans-serif;
}

/* Splash image */
img.splash {
    width: var(--splash-width);
}

/* Reduce list indentation */
li {
    list-style-type: disc;
}

/* Make navigation controls larger */
nav {
    font-size: var(--size-subtitle);
}

/* Appendix list */
ol.toc-appendices li {
    list-style-type: upper-latin;
}

/* Chapter list */
ol.toc-chapters li {
    list-style-type: decimal;
}

/* Note to self */
p.fixme {
    text-decoration-line: underline;
    text-decoration-color: var(--color-warning);
}

/* Subtitle on home page */
p.subtitle {
    text-align: center;
    font-size: var(--size-subtitle);
    font-style: italic;
    margin-top: var(--border-heavy);
    margin-bottom: var(--border-heavy);
}

/* Term definitions */
p.terms {
    font-style: italic;
}

/* Index entry */
span.ix-entry {
}

/* Tables */
table {
    border-collapse: collapse;
    caption-side: bottom;
    margin-left: auto;
    margin-right: auto;
}

/* Table cells */
th, td {
    padding-top: var(--border-medium);
    padding-bottom: var(--border-medium);
    padding-left: var(--spacing-medium);
    padding-right: var(--spacing-medium);
    vertical-align: top;
    border: solid var(--border-thin) var(--gray-light);
}

/* Key points listing at chapter start */
ul.keypoints {
    background-color: var(--gray-light);
    border: var(--border-medium) var(--gray-dark) solid;
}
