/* ---------- base ---------- */
:root {
    --accent: #C82D2D;
    --accent-dark: #461220;
    --text: #4a4955;
    --muted: #8a8994;
    --border: #e4e4e8;
    --code-bg: #f6f6f8;
    --radius: 6px;
    --article-width: 700px; /* content images are resized for it: IMAGE_WIDTH in build.py */
}
html, body {
    height: 100%;
}
html {
    scroll-behavior: smooth;
}
body {
    color: var(--text);
    line-height: 1.5;
    border-top: 8px solid var(--accent);
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
}
a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s ease-out;
}
a:hover {
    color: var(--accent-dark);
}
:target {
    scroll-margin-top: 1rem;
}

/* ---------- layout ---------- */
.container {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--article-width);
    padding: 0 1rem;
}
.content {
    flex: 1 0 auto;
}
.text-center {
    text-align: center;
}

.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    min-height: 3.25rem;
    padding: .4rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.navbar-brand {
    color: var(--text);
    font-weight: 700;
}
.navbar-links {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}
.navbar-links a {
    color: var(--text);
    font-size: .875rem;
    padding: .35rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.navbar-links a:hover {
    border-color: var(--text);
}
.navbar-links a.is-active {
    color: #fff;
    background: var(--text);
    border-color: var(--text);
}

header:after {
    content: "";
    display: block;
    margin: 0 auto;
    max-width: var(--article-width);
    padding-top: 20px;
    border-bottom: 1px solid #c82d2d8f;
}
.home-links {
    justify-content: center;
    margin-top: 1rem;
}
.profile-img {
    border-radius: 50%;
    border: 5px solid #fbfbfd;
    box-shadow: 0 15px 30px 0 rgba(67,66,160,.11), 0 5px 15px 0 rgba(14,22,83,.08);
    max-width: 120px;
    margin-top: 1rem;
}

footer {
    color: #fff;
    background-color: var(--accent);
    padding: 2rem .5rem;
    flex-shrink: 0;
}
footer a {
    color: #fff;
    padding: 10px 20px;
}
footer a:hover {
    color: #c3c3c3;
}

/* ---------- article content (blog posts and docs) ---------- */
article img, article video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}
article figure {
    margin: 1.5rem 0;
}
article figcaption {
    color: var(--muted);
    font-size: .875rem;
    text-align: center;
    margin-top: .25rem;
}
article :not(pre) > code {
    font-size: .9em;
    background: var(--code-bg);
    padding: .1em .35em;
    border-radius: 3px;
}
article table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: .925rem;
    display: block;
    overflow-x: auto;
}
article th, article td {
    text-align: left;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
}
article tbody tr:nth-child(odd) {
    background: #fafafb;
}

/* ---------- code blocks ---------- */
.code-block {
    position: relative;
    margin: 1rem 0;
}
.code-tags {
    position: absolute;
    top: .5rem;
    right: .5rem;
    display: flex;
    gap: .25rem;
}
.tag {
    font: inherit;
    font-size: .75rem;
    padding: .1rem .5rem;
    border: 0;
    border-radius: 4px;
    background: #e8e8ec;
    color: var(--text);
}
.tag.copy {
    cursor: pointer;
    background: var(--text);
    color: #fff;
}
pre.highlight {
    overflow-x: auto;
    margin: 0;
    padding: 1rem;
    padding-top: 2.25rem;
    background: var(--code-bg);
    border-radius: var(--radius);
    font-size: .85rem;
}
pre.highlight.line-numbers {
    counter-reset: line;
    padding-left: 3.25rem;
}
.line-numbers .line::before {
    counter-increment: line;
    content: counter(line);
    display: inline-block;
    width: 1.75rem;
    margin-left: -2.75rem;
    margin-right: 1rem;
    text-align: right;
    color: var(--muted);
    user-select: none;
}

/* ---------- docs: menu | article | on this page ---------- */
.docs {
    display: grid;
    grid-template-columns: 220px minmax(0, var(--article-width)) 200px;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    padding: 1.5rem 1rem 3rem;
    box-sizing: border-box;
}
.docs-menu, .toc {
    font-size: .925rem;
}
.docs-menu p {
    font-weight: 700;
    margin: 1.25rem 0 .25rem;
}
.docs-menu a {
    display: block;
    color: var(--text);
    padding: .3rem .6rem;
    border-radius: var(--radius);
}
.docs-menu a:hover {
    background: var(--code-bg);
}
.docs-menu a.is-active {
    background: var(--code-bg);
    color: var(--accent);
    font-weight: 700;
}
.toc-title {
    font-weight: 700;
    margin-top: 0;
}
.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.toc li {
    margin: .4rem 0;
    line-height: 1.4;
}
.toc a {
    color: var(--muted);
}
.toc a:hover {
    color: var(--text);
}
.toc .toc-h3 {
    padding-left: 1rem;
}

/* sidebars stay in view while scrolling, where they sit beside the article */
@media (min-width: 761px) {
    .docs-menu, .toc {
        position: sticky;
        top: 1.5rem;
        align-self: start;
        max-height: calc(100vh - 3rem);
        overflow-y: auto;
    }
}
@media (max-width: 1100px) {
    .docs {
        grid-template-columns: 200px minmax(0, var(--article-width));
    }
    .toc {
        display: none;
    }
}
@media (max-width: 760px) {
    .docs {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }
    /* menu moves under the article on phones */
    .docs-menu {
        order: 2;
        border-top: 1px solid var(--border);
    }
}
