/* aibysitter: monospace, paper and ink, color only for status. */

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --paper: #fbfaf8;
    --ink: #1d1c1a;
    --body: #45433f;
    --mute: #6e6b65;
    --surface: #f2f0ec;
    --hairline: rgba(29, 28, 26, 0.14);
    --hairline-strong: rgba(29, 28, 26, 0.32);
    --term: #1c1b19;
    --term-ink: #ecebe7;
    --term-mute: #8f8c86;
    --term-border: transparent;
    --pass: #2e7d32;
    --warn: #9a6400;
    --fail: #b3261e;
    --pass-bg: rgba(46, 125, 50, 0.08);
    --warn-bg: rgba(154, 100, 0, 0.09);
    --fail-bg: rgba(179, 38, 30, 0.08);

    --font: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
    --text-sm: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-display: 2.25rem;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-xxl: 32px;
    --space-section: 96px;
    --radius: 4px;
    --measure: 72ch;
    --column: 960px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #161514;
        --ink: #ecebe7;
        --body: #c9c7c2;
        --mute: #9a9792;
        --surface: #201f1d;
        --hairline: rgba(236, 235, 231, 0.14);
        --hairline-strong: rgba(236, 235, 231, 0.34);
        --term: #0f0f0e;
        --term-border: rgba(236, 235, 231, 0.16);
        --pass: #6fbf73;
        --warn: #e0a640;
        --fail: #f07167;
        --pass-bg: rgba(111, 191, 115, 0.12);
        --warn-bg: rgba(224, 166, 64, 0.12);
        --fail-bg: rgba(240, 113, 103, 0.12);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--body);
    font: 400 var(--text-md)/1.6 var(--font);
    font-variant-ligatures: none;
}

h1, h2, h3 {
    color: var(--ink);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 var(--space-lg);
    overflow-wrap: break-word;
}

h1 { font-size: var(--text-display); letter-spacing: -0.01em; max-width: 24ch; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); }

p, ul, ol, dl, pre, table, figure { margin: 0 0 var(--space-lg); }
p { max-width: var(--measure); }

a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: 2px;
}

code, pre, kbd { font-family: var(--font); font-size: inherit; }

main :not(pre) > code { overflow-wrap: anywhere; }

.skip {
    position: absolute;
    left: -9999px;
}

.skip:focus {
    left: var(--space-lg);
    top: var(--space-sm);
    background: var(--paper);
    padding: var(--space-xs) var(--space-sm);
    z-index: 1;
}

/* Frame */

.site-header,
main,
.site-footer {
    max-width: calc(var(--column) + 2 * var(--space-lg));
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.site-header { border-bottom: 1px solid var(--hairline); }

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: var(--space-lg);
}

.wordmark {
    white-space: nowrap;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    font-size: var(--text-lg);
    display: inline-flex;
    align-items: center;
}

.wordmark .mark { width: 1.5em; height: 1.5em; margin-right: 0.5em; flex: none; }
.mark-tile { fill: var(--ink); }
.mark-glyph { fill: var(--paper); }
.mark-dot { fill: var(--pass); }

.nav-links {
    display: flex;
    gap: var(--space-xl);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--mute);
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }

main { padding-top: var(--space-section); padding-bottom: var(--space-section); }

.site-footer {
    border-top: 1px solid var(--hairline);
    padding-top: var(--space-xxl);
    padding-bottom: var(--space-xxl);
    color: var(--mute);
    font-size: var(--text-sm);
}

.site-footer p { margin: 0; }

/* Cursor: the only motion on the site. */

.cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: currentColor;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.wordmark .cursor { animation: none; }

@media (prefers-reduced-motion: reduce) {
    .cursor { animation: none; }
}

/* Home */

.hero { margin-bottom: var(--space-xxl); }

.lede { font-size: var(--text-md); color: var(--body); }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.status {
    list-style: none;
    padding: 0;
    margin-top: var(--space-xl);
    font-size: var(--text-sm);
}

.status li { margin-bottom: var(--space-xs); }
.status li span { color: var(--mute); }
.status li span::before { content: "— "; }

.score-label { color: var(--mute); }

[hidden] { display: none !important; }

.note-body table, .rendered table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.rules-picker { margin: var(--space-md) 0; }
.rules-picker fieldset { border: 0; padding: 0; margin: var(--space-sm) 0 0; columns: 2 18ch; }
.rules-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.rules-picker label { display: block; font-size: var(--text-sm); break-inside: avoid; }

.config-form fieldset { border: 0; padding: 0; margin: 0 0 var(--space-xl); min-width: 0; }
.config-form legend { padding: 0; margin-bottom: var(--space-sm); color: var(--ink); font-weight: 500; }
.config-form .choices { columns: 2 22ch; }
.config-form .choices label, .config-form label.choice { font-size: var(--text-sm); font-weight: 400; break-inside: avoid; margin-bottom: var(--space-xs); }
.config-form textarea, .config-form input[type="text"] { margin-bottom: var(--space-sm); }
.config-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }
button.secondary[type="submit"] { background: var(--paper); border-color: var(--hairline-strong); color: var(--ink); }
.errors { color: var(--fail); }
#config-output { margin-top: var(--space-xl); }

.share { margin-top: var(--space-xl); }
.share-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-md); margin: var(--space-sm) 0; }

.url-form { margin-top: var(--space-xl); }
.also-found { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); margin-bottom: var(--space-md); }
.inline-form { display: inline; margin: 0; }
button.link-button[type="submit"] {
    background: none;
    border: 0;
    padding: 0;
    color: var(--ink);
    font: inherit;
    font-size: var(--text-sm);
    text-decoration: underline;
    text-align: left;
    cursor: pointer;
    filter: none;
}

.file-fix { display: block; color: var(--mute); }

.provenance { color: var(--mute); font-size: var(--text-sm); }

.legacy {
    display: inline-block;
    padding: 0 var(--space-sm);
    border: 1px dashed var(--mute);
    border-radius: var(--radius);
    color: var(--mute);
    font-size: var(--text-sm);
    line-height: 1.7;
    white-space: nowrap;
}

.view-switch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); }

.frontmatter { color: var(--mute); }

.rendered {
    border-left: 2px solid var(--hairline);
    padding-left: var(--space-lg);
}

.gap {
    border: 1px dashed var(--warn);
    padding: var(--space-sm) var(--space-md);
    color: var(--warn);
}

.terminal {
    margin: 0 0 var(--space-section);
    background: var(--term);
    color: var(--term-ink);
    border: 1px solid var(--term-border);
}

.terminal pre {
    margin: 0;
    padding: var(--space-xxl) var(--space-xl);
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: 1.9;
}

.terminal figcaption {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid rgba(236, 235, 231, 0.12);
    color: var(--term-mute);
    font-size: var(--text-sm);
}

.terminal figcaption a { color: var(--term-ink); }

.t-prompt, .t-loc { color: var(--term-mute); }
.t-rule { color: var(--term-ink); font-weight: 700; }
.t-sum { color: var(--term-ink); font-weight: 700; }
.t-error { color: #f07167; }
.t-warning { color: #e0a640; }
.t-info { color: #9fb7d9; }

.section {
    border-top: 1px solid var(--hairline);
    padding-top: var(--space-xxl);
    margin-bottom: var(--space-section);
}

.section:last-child { margin-bottom: 0; }

.columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xxl);
}

.marks {
    list-style: none;
    padding: 0;
}

.marks li {
    position: relative;
    padding-left: 4ch;
    margin-bottom: var(--space-sm);
}

.marks li::before {
    content: "[+]";
    position: absolute;
    left: 0;
    color: var(--mute);
}

.marks .id { font-weight: 700; color: var(--ink); }
.marks a { font-weight: 700; }

.note { color: var(--mute); font-size: var(--text-sm); }

/* Controls */

.button,
button {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: var(--space-xs) 20px;
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    font: 500 var(--text-md)/2 var(--font);
    text-decoration: none;
    cursor: pointer;
}

.button.primary,
button[type="submit"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.button:hover,
button:hover { text-decoration: none; filter: brightness(1.12); }

label {
    display: block;
    color: var(--ink);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

textarea, input[type="text"] {
    display: block;
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: 400 var(--text-sm)/1.6 var(--font);
    resize: vertical;
}

input[type="text"] { resize: none; }

textarea:focus, input[type="text"]:focus { background: var(--paper); }

select {
    display: block;
    max-width: 100%;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: 400 var(--text-sm)/1.6 var(--font);
}

select:focus { background: var(--paper); }

form button { margin-top: var(--space-md); }

.sample-link { margin-left: var(--space-lg); }

.error { color: var(--fail); display: block; margin-top: var(--space-sm); }

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

th, td {
    text-align: left;
    vertical-align: top;
    padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
    border-bottom: 1px solid var(--hairline);
}

th { color: var(--mute); font-weight: 500; }
td:first-child, th:first-child { white-space: nowrap; }

tr.sev-error td:first-child { box-shadow: inset 3px 0 0 var(--fail); padding-left: var(--space-md); }
tr.sev-warning td:first-child { box-shadow: inset 3px 0 0 var(--warn); padding-left: var(--space-md); }
tr.sev-info td:first-child { box-shadow: inset 3px 0 0 var(--hairline-strong); padding-left: var(--space-md); }

/* Score */

.score {
    margin: var(--space-xxl) 0;
    padding: var(--space-lg) var(--space-xl);
    border: 1px solid var(--hairline);
    border-left-width: 4px;
    border-radius: var(--radius);
}

.score h2 { font-size: var(--text-md); color: var(--mute); font-weight: 500; margin-bottom: var(--space-xs); }
.score-value { font-size: var(--text-display); font-weight: 700; color: var(--ink); margin-bottom: var(--space-lg); }

.score.grade-a, .score.grade-b { border-left-color: var(--pass); background: var(--pass-bg); }
.score.grade-c, .score.grade-d { border-left-color: var(--warn); background: var(--warn-bg); }
.score.grade-f { border-left-color: var(--fail); background: var(--fail-bg); }

/* Notes */

pre:not(.terminal pre) {
    padding: var(--space-md) var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: var(--text-sm);
}

dt { color: var(--ink); font-weight: 700; margin-top: var(--space-md); }
dd { margin: 0; max-width: var(--measure); }

/* Narrow screens */

@media (max-width: 700px) {
    :root { --space-section: 64px; --text-display: 1.75rem; }
    .columns { grid-template-columns: 1fr; }
    .nav { flex-wrap: wrap; row-gap: 0; }
    .wordmark { font-size: var(--text-md); }
    .nav-links { gap: var(--space-md); font-size: var(--text-sm); }
    .stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .stack tbody, .stack tr { display: block; }

    .stack tr {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        column-gap: var(--space-md);
        padding: var(--space-md) 0;
        border-bottom: 1px solid var(--hairline);
    }

    .findings.stack tr { grid-template-columns: calc(3ch + var(--space-md)) minmax(0, 1fr); }
    .stack td { border: 0; padding: 0; }
    .stack td:first-child { grid-row: span 4; }
    .stack td:nth-child(2) { color: var(--ink); }
    .stack td:nth-child(3) { color: var(--mute); }
    .stack td:nth-child(5) { color: var(--mute); margin-top: var(--space-xs); }
    .terminal pre { padding: var(--space-xl) var(--space-lg); }
}

/* Gallery */

.filters ul,
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-lg);
}

.filters a,
.tags a {
    display: inline-block;
    padding: 0 var(--space-sm);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    color: var(--body);
    text-decoration: none;
    font-size: var(--text-sm);
    line-height: 2;
}

.filters a:hover,
.tags a:hover { border-color: var(--hairline-strong); color: var(--ink); }
.pack .tags li { padding: 0 var(--space-sm); border: 1px solid var(--hairline); border-radius: var(--radius); color: var(--body); font-size: var(--text-sm); }

.filters a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.filter-note { font-size: var(--text-sm); color: var(--mute); }

.gallery {
    list-style: none;
    padding: 0;
    margin: var(--space-xxl) 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-xxl);
}

.packs { list-style: none; padding: 0; margin: var(--space-xxl) 0 0; }
.pack-sections { list-style: none; padding: 0; margin: var(--space-md) 0 0; }
.pack-sections li { border-top: 1px solid var(--hairline); }
.pack-sections summary { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); padding: var(--space-sm) 0; cursor: pointer; }
.pack-sections .rendered { padding-bottom: var(--space-md); }
.pack { min-width: 0; }
.pack pre { max-width: 100%; }

.entry {
    border-top: 1px solid var(--hairline);
    padding: var(--space-xl) 0 var(--space-xxl);
}

.entry h2 { font-size: var(--text-lg); margin-bottom: var(--space-sm); }
.entry h2 a { text-decoration: none; }
.entry h2 a:hover { text-decoration: underline; }

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    color: var(--mute);
    font-size: var(--text-sm);
}

.grade {
    display: inline-block;
    padding: 0 var(--space-sm);
    border: 1px solid currentColor;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.7;
    white-space: nowrap;
}

.grade.grade-a, .grade.grade-b { color: var(--pass); }
.grade.grade-c, .grade.grade-d { color: var(--warn); }
.grade.grade-f { color: var(--fail); }

.empty { color: var(--mute); }

.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: var(--space-xl);
    row-gap: var(--space-sm);
    margin: var(--space-xl) 0;
}

.facts dt { margin: 0; color: var(--mute); font-weight: 500; }
.facts dd .tags { margin: 0; }

.file {
    counter-reset: line;
    list-style: none;
    margin: 0 0 var(--space-xl);
    padding: var(--space-md) 0;
    background: var(--surface);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

.file li {
    counter-increment: line;
    display: grid;
    grid-template-columns: 5ch minmax(0, 1fr);
    padding: 0 var(--space-lg) 0 0;
    min-height: 1.6em;
}

.file li::before {
    content: counter(line);
    color: var(--mute);
    text-align: right;
    padding-right: 2ch;
    user-select: none;
}

.file code { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }

.file-note {
    grid-column: 2;
    margin: var(--space-xs) 0;
    padding-left: var(--space-md);
    font-size: var(--text-sm);
}

.file-note.sev-error { box-shadow: inset 3px 0 0 var(--fail); }
.file-note.sev-warning { box-shadow: inset 3px 0 0 var(--warn); }
.file-note.sev-info { box-shadow: inset 3px 0 0 var(--hairline-strong); }

@media (max-width: 700px) {
    .gallery { grid-template-columns: 1fr; }
    .facts { grid-template-columns: 1fr; row-gap: 0; }
    .facts dd { margin-bottom: var(--space-md); }
}

/* GitHub page */

.install-status {
    display: inline-block;
    padding: var(--space-sm) var(--space-md);
    border: 1px dashed var(--hairline-strong);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

main code { background: var(--surface); padding: 0 3px; border-radius: 2px; }
main pre code, .terminal code { background: none; padding: 0; }
