/*
 * Adapted from archmanweb, https://gitlab.archlinux.org/archlinux/archmanweb
 * SPDX-License-Identifier: GPL-3.0-only
 */

/* simple reset */
* {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

:root {
  color-scheme: light dark;

  --color: light-dark(#222, #ddd);
  --code-block-bg-color: light-dark(#dfd, #023);
  --code-block-border-color: light-dark(#bdb, #384756);
  --link-color: light-dark(#07b, #00b6f9);
  --table-border-color: light-dark(#bcd, #384756);
  --table-bg-color: light-dark(#ecf2f5, #242b2e);
  --table-th-bg-color: light-dark(rgb(217, 230, 236), #273136);
  --table-focus-bg-color: light-dark(rgb(228, 237, 241), #273136);
}

/* general styling */
body {
    color: var(--color);
    font: normal 100% sans-serif;
    /* set min-width to prevent over-shrinking of the body when
     * a flex-container child refuses to shrink */
    min-width: min-content;
}

p:not(:first-child) {
    margin-top: .33em;
}

p:not(:last-child) {
    margin-bottom: 1em;
}

ul {
    padding-left: 2em;
    list-style: square;
}

ul:not(:last-child) {
    margin-bottom: 1em;
}

pre {
    font-family: monospace, monospace;
    border: 1px solid var(--code-block-border-color);
    background: var(--code-block-bg-color);
    padding: 0.5em;
    margin: 1em 0;
    overflow: auto;
    white-space: pre-wrap;
}

/* scale fonts down to a sane default (16 * .875 = 14px) */
#content {
    font-size: 0.875em;
}

/* Arch style for links */
a {
    text-decoration: none;
}

a:link {
    color: var(--link-color);
}

a:visited {
    color: #666;
}

a:hover {
    text-decoration: underline;
    color: #666;
}

a:active {
    color: #e90;
}

/* headings */
h2 {
    font-size: 1.5em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid #888;
}

/* general layout */
main#content {
    display: flex;
    margin: 1em;
    justify-content: center;
    gap: 2em;
}

#content-left {
    display: block;
    order: 1;
    /* max-width of the content has to be specified here to make it play nice
     * with flex. Setting it to max-content would prevent growing beyond the
     * largest child element. */
    max-width: 80ch;
    /* set min-width to prevent excessive shrinking
     * (and to force shrinking in case there is an element which refuses to
     * shrink, e.g. a very long line in a <pre> tag) */
    min-width: 40ch;
    /* set initial/ideal width to 70% */
    flex-basis: 70%;
    /* shrink factor of 0 effectively means that it will not shrink below 70% of
     * the available space (the sidebar will be shrunk instead) */
    flex-shrink: 0;
    /* increase grow factor to expand into the extra space at the cost of the
     * sidebar */
    flex-grow: 1;
}

#sidebar {
    display: flex;
    flex-direction: column;
    gap: 1em;
    order: 2;
    /* set min-width to prevent excessive shrinking
     * (and to force shrinking in case there is an element which refuses to
     * shrink, e.g. a very long word) */
    min-width: 20ch;
    /* set max-width to prevent excessive growing */
    max-width: 40ch;
    /* sets flex base width to 30% (complement of the main content's base) */
    flex-basis: 30%;
}

/* responsive layout */
@media only screen and (max-width: 700px) {
    main#content {
        /* place the items in vertical direction */
        flex-direction: column;
        gap: 1em;
    }

    #sidebar {
        max-width: 80ch;
    }
}