/* 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 {
    --color-decorate: #808080;
    --color-highlight: #f0f0f8;
    --color-page: #f8f8f8;
    --color-link-unvisited: #0066ff;
    --color-link-visited: #0000ff;

    --font-prose: "Atkinson Hyperlegible", Arial, sans-serif;
    --font-code: "Source Code Pro", "Courier New", monospace;

    --len-dropdown: 200px;
    --len-half: 0.5rem;
    --len-line-height: 1.4; /* instead of standard 1.2 */
    --len-one: 1rem;
    --len-page: 60rem;
    --len-quarter: 0.25rem;
    --len-thick-double: 8px;
    --len-thick: 4px;
    --len-thin: 1px;

    --size-prose: 1.2rem;
    --size-code: 1.1rem;
}

/* Flex grid */

.row {
    display: flex;
    flex-flow: row wrap;
    width: 100%
}

.row > * {
  flex: 1; /* allow children to grow when space available */
}

.col-1 { flex-basis: 8.33%; }
.col-2 { flex-basis: 16.66%; }
.col-3 { flex-basis: 25%; }
.col-4 { flex-basis: 33.33%; }
.col-5 { flex-basis: 41.66%; }
.col-6 { flex-basis: 50%; }
.col-7 { flex-basis: 58.33%; }
.col-8 { flex-basis: 66.66%; }
.col-9 { flex-basis: 75%; }
.col-10 { flex-basis: 83.33%; }
.col-11 { flex-basis: 91.66%; }
.col-12 { flex-basis: 100%; }

/* Responsive breakpoints */
@media (max-width: 768px) {
    .row > * {
        flex-basis: 100% !important;
    }
}

/* Dropdown menu */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown > a {
    text-decoration: none;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--color-highlight);
    min-width: var(--len-dropdown);
    box-shadow: 0px var(--len-thick) var(--len-thick-double) 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--len-thick);
}

.dropdown-content a {
    padding-left: var(--len-thick);
    padding-right: var(--len-thick);
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.dropdown-content a:hover {
    color: var(--color-link-visited);
}

.dropdown:hover .dropdown-content {
    display: block;
}

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

.right {
    text-align: right;
}

.center {
    text-align: center;
}

/* Links */
a[href] {
    color: var(--color-link-unvisited);
}
a[href]:visited {
    color: var(--color-link-visited);
}
a[href]:hover {
    color: var(--color-link-visited);
}

/* Quotes */
blockquote {
    border-left: solid var(--len-thick) var(--color-decorate);
    margin-left: 0px;
    padding-left: var(--len-half);
    padding-top: 0;
    padding-bottom: 0;
    margin-top: var(--len-thick);
    margin-bottom: var(--len-thick);
    background-color: var(--color-highlight);
}

/* Whole document */
body {
    font-family: var(--font-prose);
    font-size: var(--size-prose);
    line-height: var(--len-line-height);
    max-width: var(--len-page);
    background-color: var(--color-page);
    margin: auto;
    padding-left: var(--len-half);
    padding-right: var(--len-half);
}

/* Code text */
code {
    font-size: var(--size-code);
}

/* Cards */
div.card {
    box-shadow: 0px var(--len-thick) var(--len-thick-double) 0px rgba(0,0,0,0.2);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border: solid var(--color-decorate) var(--len-thick);
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: var(--len-half);
    padding-right: var(--len-half);
    margin: var(--len-half);
}

div.card > h3 {
    font-size: 1.3rem;
}
div.card > p {
    margin-top: 0px;
    margin-bottom: var(--len-half);
}

/* Footer */
footer {
    margin-top: var(--len-half);
    border-top: solid var(--color-decorate) var(--len-thin);
    padding-top: var(--len-half);
    margin-bottom: var(--len-half);
    text-align: center;
}

/* Headings */
h1, h2, h3 {
    margin-bottom: var(--len-thick-double);
}
h2, h3 {
    margin-top: var(--len-thick);
}

/* Page heading */
h1 {
    text-align: center;
}
p.subtitle {
    text-align: center;
    font-style: italic;
}

/* Navigation */
nav {
    margin-top: var(--len-half);
    border-bottom: solid var(--color-decorate) var(--len-thin);
    margin-bottom: var(--len-half);
    padding-bottom: var(--len-half);
}

/* Code block */
pre {
    background-color: var(--color-highlight);
    padding: var(--len-half);
}

/* Table */
table {
  text-align: justify;
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--len-half);
}

td, th {
  padding: var(--len-half);
  border: solid var(--len-thin) var(--color-decorate);
}

tr:hover {
    background-color: var(--color-highlight);
}

thead {
    background-color: var(--color-highlight);
}

/* Lists */
ol {
  padding-left: var(--len-one);
  margin-top: 0px;
}
ul {
  padding-left: var(--len-one);
  margin-top: 0px;
  list-style-type: disc;
}

/* Callouts */
div.callout {
    background-color: #f1f1f1;
    font-style: italic;
}
div.callout > p {
    padding: var(--len-thick);
}

/* Exercise blocks */
section.exercise {
    background-color: #f1f1f1;
    padding-left: var(--len-one);
    padding-right: var(--len-half);
    padding-top: var(--len-half);
    margin-bottom: var(--len-half);
    border: solid var(--len-thick) var(--color-decorate);
    border-radius: var(--len-thick);
}
section.exercise h3 {
    font-size: 1.5em;
}

/* Definitions */

dt:not(:first-child) {
    margin-top: var(--len-quarter);
}

dt {
    font-weight: bold;
}
