/* Tessel documentation site. Hand written, no frameworks.
   Dark by default, with a light theme for people whose system asks for it. */

:root {
    color-scheme: dark;

    --bg: #2b2d31;
    --bg-sunken: #232528;
    --panel: #33363b;
    --panel-raised: #3b3f45;
    --border: #45494f;
    --text: #e6e8eb;
    --text-dim: #aab0b8;
    --accent: #3d8bfd;
    --accent-strong: #6ba6ff;
    --accent-ink: #0b1420;
    --code-bg: #232528;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .28);

    --radius: 8px;
    --measure: 68rem;
    --gutter: 16px;
}

/* Light theme: follows the system setting unless the page was switched to dark. */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;

        --bg: #f3f4f6;
        --bg-sunken: #e7e9ec;
        --panel: #ffffff;
        --panel-raised: #f7f8fa;
        --border: #d3d7dd;
        --text: #1b1d21;
        --text-dim: #565c66;
        --accent: #1763c6;
        --accent-strong: #11498f;
        --accent-ink: #ffffff;
        --code-bg: #eef0f3;
        --shadow: 0 1px 2px rgba(16, 20, 26, .10), 0 8px 24px rgba(16, 20, 26, .08);
    }
}

/* The same light theme when the reader picks it explicitly. */
:root[data-theme="light"] {
    color-scheme: light;

    --bg: #f3f4f6;
    --bg-sunken: #e7e9ec;
    --panel: #ffffff;
    --panel-raised: #f7f8fa;
    --border: #d3d7dd;
    --text: #1b1d21;
    --text-dim: #565c66;
    --accent: #1763c6;
    --accent-strong: #11498f;
    --accent-ink: #ffffff;
    --code-bg: #eef0f3;
    --shadow: 0 1px 2px rgba(16, 20, 26, .10), 0 8px 24px rgba(16, 20, 26, .08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
    font-size: 17px;
    line-height: 1.62;
    -webkit-text-size-adjust: 100%;
}

code,
pre,
kbd {
    font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas,
        "DejaVu Sans Mono", monospace;
}

/* ------------------------------------------------------------------ layout */

.wrap {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

main {
    padding: 8px 0 56px;
}

section {
    margin: 0 0 44px;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 10px 16px;
    border-radius: 0 0 var(--radius) 0;
    z-index: 20;
}

.skip:focus {
    left: 0;
}

/* ------------------------------------------------------------------ header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.12rem;
    letter-spacing: .01em;
    color: var(--text);
    text-decoration: none;
}

.brand:hover,
.brand:focus {
    color: var(--accent-strong);
}

.brand-mark {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--accent) 0 50%, var(--text-dim) 50% 100%);
    flex: none;
}

.site-nav {
    margin-left: auto;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: inline-block;
    padding: 6px 11px;
    border-radius: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: .96rem;
}

.site-nav a:hover,
.site-nav a:focus {
    background: var(--panel-raised);
    color: var(--text);
}

.site-nav a[aria-current="page"] {
    color: var(--text);
    background: var(--panel-raised);
    box-shadow: inset 0 -2px 0 var(--accent);
}

/* Added by the theme script; the page is fine without it. */
.theme-toggle {
    margin-left: 6px;
    padding: 6px 11px;
    font: inherit;
    font-size: .92rem;
    color: var(--text-dim);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus {
    color: var(--text);
    border-color: var(--accent);
}

/* ------------------------------------------------------------------ text */

h1,
h2,
h3,
h4 {
    line-height: 1.22;
    margin: 0 0 .5em;
    font-weight: 700;
}

h1 {
    font-size: clamp(2rem, 1.3rem + 2.6vw, 2.9rem);
    letter-spacing: -.015em;
}

h2 {
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
    margin-top: 1.2em;
    padding-bottom: .3em;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.14rem;
    margin-top: 1.5em;
}

h4 {
    font-size: 1rem;
    margin-top: 1.3em;
    color: var(--text);
}

p,
ul,
ol,
dl {
    margin: 0 0 1em;
}

ul,
ol {
    padding-left: 1.35em;
}

li {
    margin: .28em 0;
}

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

a:hover,
a:focus {
    color: var(--accent-strong);
}

.lede {
    font-size: 1.12rem;
    color: var(--text-dim);
    max-width: 46rem;
}

.muted {
    color: var(--text-dim);
}

strong {
    color: var(--text);
}

kbd {
    display: inline-block;
    min-width: 1.5em;
    padding: 1px 6px 2px;
    background: var(--panel-raised);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-size: .86em;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    color: var(--text);
}

code {
    padding: .1em .35em;
    background: var(--code-bg);
    border-radius: 4px;
    font-size: .9em;
}

pre {
    margin: 0 0 1em;
    padding: 14px 16px;
    overflow-x: auto;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .88rem;
    line-height: 1.55;
}

pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

/* ------------------------------------------------------------------ hero */

.hero {
    padding: 40px 0 8px;
}

.hero h1 {
    margin-bottom: .28em;
}

.hero .version {
    display: inline-block;
    margin-bottom: 14px;
    padding: 2px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: .84rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 0;
}

.button {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: none;
}

.button:hover,
.button:focus {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: var(--accent-ink);
}

.button.secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.button.secondary:hover,
.button.secondary:focus {
    border-color: var(--accent);
    color: var(--text);
}

/* ------------------------------------------------------------------ figures */

figure {
    margin: 0 0 24px;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

figcaption {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: .9rem;
}

/* A picture of something small, such as a dialog or the tool palette. Stretched
   to the width of the column it only gets blurry, so it keeps its own size. */
figure.narrow img {
    width: auto;
    max-width: 100%;
    margin-inline: auto;
}

/* The tool options bar is one long row. Below the width it was grabbed at its
   labels stop being readable, so it scrolls sideways rather than shrinking. */
figure.strip {
    overflow-x: auto;
}

figure.strip img {
    width: auto;
    max-width: none;
}

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.shots li {
    margin: 0;
}

/* ------------------------------------------------------------------ cards */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 16px;
    margin: 0 0 1em;
    padding: 0;
    list-style: none;
}

.cards > li,
.card {
    margin: 0;
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.cards h3 {
    margin: 0 0 .4em;
    font-size: 1.04rem;
}

.cards p:last-child,
.cards ul:last-child,
.card p:last-child {
    margin-bottom: 0;
}

.note {
    margin: 0 0 1em;
    padding: 14px 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
}

.note p:last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ tables */

.table-scroll {
    margin: 0 0 1.4em;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .96rem;
    background: var(--panel);
}

caption {
    padding: 10px 14px;
    background: var(--panel-raised);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .9rem;
    text-align: left;
}

th,
td {
    padding: 9px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

thead th {
    background: var(--panel-raised);
    font-size: .86rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-dim);
}

tbody tr:last-child th,
tbody tr:last-child td {
    border-bottom: 0;
}

tbody th {
    font-weight: 600;
    white-space: nowrap;
}

td.keys {
    white-space: nowrap;
}

/* ------------------------------------------------------------------ misc */

dl.defs dt {
    margin-top: .9em;
    font-weight: 600;
}

dl.defs dd {
    margin: .2em 0 0;
    color: var(--text-dim);
}

.toc {
    padding: 16px 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.toc h2 {
    margin: 0 0 .4em;
    padding: 0;
    border: 0;
    font-size: 1rem;
}

.toc ul {
    margin: 0;
    columns: 2;
    column-gap: 28px;
}

/* ------------------------------------------------------------------ footer */

.site-footer {
    padding: 24px 0 36px;
    background: var(--bg-sunken);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .92rem;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    align-items: baseline;
    justify-content: space-between;
}

.site-footer p {
    margin: .3em 0;
}

.site-footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: .3em 0;
    padding: 0;
    list-style: none;
}

/* ------------------------------------------------------------------ small */

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    .site-header .wrap {
        align-items: flex-start;
    }

    .site-nav {
        margin-left: 0;
        width: 100%;
    }

    .hero {
        padding-top: 26px;
    }

    .actions .button {
        flex: 1 1 auto;
        text-align: center;
    }

    .toc ul {
        columns: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
