@font-face {
    font-family: "VT323";
    src: url("/assets/fonts/vt323.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* A firmware setup screen. Dark is the classic blue field, light is a pale UEFI sheet.
   Everything sits on character cells: one bitmap face, two sizes, double-line frames. */
:root {
    --field: #0000aa;
    --field-deep: #00007a;
    --text: #ffffff;
    --dim: #b4b4e6;
    --line: #aaaaaa;
    --bar: #aaaaaa;
    --bar-ink: #000000;
    --hi: #aaaaaa;
    --hi-ink: #0000aa;
    --title: #55ffff;
    --value: #ffff55;
    --ok: #55ff55;
    --warn: #ff8080;
    --warn-field: #1a0000;
    --focus: #ffff55;
    --value-ink: #000000;
    --code: #000070;
    --font: "VT323", "Cascadia Mono", Consolas, "Lucida Console", monospace;
    --cell: 22px;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --field: #f2f2ee;
    --field-deep: #e4e4de;
    --text: #0b0b3a;
    --dim: #4a4a70;
    --line: #000080;
    --bar: #000080;
    --bar-ink: #ffffff;
    --hi: #000080;
    --hi-ink: #ffffff;
    --title: #00508a;
    --value: #7a3d00;
    --ok: #0a6a1a;
    --warn: #a40000;
    --warn-field: #fff0f0;
    --focus: #b30000;
    --value-ink: #ffffff;
    --code: #e0e0f2;
    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --field: #f2f2ee;
        --field-deep: #e4e4de;
        --text: #0b0b3a;
        --dim: #4a4a70;
        --line: #000080;
        --bar: #000080;
        --bar-ink: #ffffff;
        --hi: #000080;
        --hi-ink: #ffffff;
        --title: #00508a;
        --value: #7a3d00;
        --ok: #0a6a1a;
        --warn: #a40000;
        --warn-field: #fff0f0;
        --focus: #b30000;
        --value-ink: #ffffff;
        --code: #e0e0f2;
        color-scheme: light;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }

main { flex: 1; }

body {
    margin: 0;
    background: var(--field);
    color: var(--text);
    font: 400 var(--cell)/1.3 var(--font);
    letter-spacing: 0.01em;
    -webkit-font-smoothing: none;
    font-smooth: never;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::selection { background: var(--hi); color: var(--hi-ink); }

/* The scrollbar is part of the screen too. */
* { scrollbar-color: var(--line) var(--field-deep); }
::-webkit-scrollbar { width: 14px; height: 14px; background: var(--field-deep); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--field-deep); }

a { color: var(--value); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { background: var(--hi); color: var(--hi-ink); text-decoration: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.skip {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    background: var(--hi);
    color: var(--hi-ink);
    padding: 4px 12px;
}
.skip:focus { top: 8px; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 16px; }

/* ---- title bar and tabs ---- */
.top {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bar);
    color: var(--bar-ink);
    border-bottom: 2px solid var(--field);
}
.top .wrap { display: flex; align-items: stretch; gap: 8px; min-height: 44px; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bar-ink);
    text-decoration: none;
    padding-right: 16px;
    white-space: nowrap;
}
.brand:hover { background: none; color: var(--bar-ink); }
.brand svg { width: 24px; height: 24px; flex: none; }

.tabs { display: flex; margin-left: auto; }
.tabs a, .tool {
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--bar-ink);
    background: none;
    border: 0;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.tabs a:hover, .tool:hover { background: var(--field); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--field); color: var(--text); box-shadow: inset 0 -3px var(--value); }
.menu-btn { display: none; margin-left: auto; }

.progress { position: fixed; top: 44px; left: 0; right: 0; height: 3px; z-index: 49; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--value); transform-origin: left; transform: scaleX(0); }

/* ---- frames ---- */
.pane {
    position: relative;
    border: 3px double var(--line);
    padding: 28px 20px 18px;
    background: var(--field);
}
.pane > .pane-title {
    position: absolute;
    top: -0.7em;
    left: 14px;
    background: var(--field);
    color: var(--title);
    padding: 0 8px;
    font-size: inherit;
    font-weight: 400;
    line-height: 1.2;
}
.pane.warn { border-color: var(--warn); background: var(--warn-field); }
.pane.warn > .pane-title { background: var(--warn-field); color: var(--warn); }

.display {
    font-size: clamp(3rem, 8vw, 5.4rem);
    line-height: 0.95;
    font-weight: 400;
    letter-spacing: 0;
}
.display .plus { color: var(--value); }

.lede { max-width: 54ch; margin-top: 12px; }
.dim { color: var(--dim); }
.ok { color: var(--ok); }
.value { color: var(--value); }
.title { color: var(--title); }
.caret { display: inline-block; width: 0.6ch; height: 1em; background: var(--value); vertical-align: -0.12em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- the screen on the home page ---- */
.screen {
    flex: 1;
    display: grid;
    gap: 28px 24px;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas:
        "intro side"
        "menu side";
    grid-template-rows: auto 1fr;
    align-content: start;
    padding-block: 28px 24px;
}
.screen > * { min-width: 0; }
.screen .intro { grid-area: intro; padding-top: 6px; }
.screen .menu-pane { grid-area: menu; align-self: start; }
.screen .side { grid-area: side; display: flex; flex-direction: column; gap: 28px; align-self: start; }
.screen .help { grid-area: help; }
.screen .install { grid-area: install; }

/* menu rows read like firmware options: name on the left, value on the right */
.rows { display: grid; }
.row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3ch;
    align-items: baseline;
    width: 100%;
    padding: 1px 10px 1px 2.2ch;
    margin: 0;
    background: none;
    color: var(--text);
    border: 0;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.row .val { color: var(--value); white-space: nowrap; }
.row .val[data-on="true"] { color: var(--ok); }
.row:hover, .row[aria-current="true"], .row.open { background: var(--hi); color: var(--hi-ink); }
.row:hover .val, .row[aria-current="true"] .val, .row.open .val { color: var(--hi-ink); }
.row:focus-visible { outline-offset: -3px; }
.row[aria-current="true"]::before { content: ">"; position: absolute; left: 1px; color: var(--hi-ink); }

.note { margin-top: 14px; color: var(--dim); max-width: 60ch; }

.help h3, .detail h3 { color: var(--title); font-size: inherit; font-weight: 400; margin-bottom: 8px; }
.help p + p, .detail p + p { margin-top: 10px; }
.help dl { margin-top: 14px; display: grid; grid-template-columns: max-content 1fr; gap: 2px 3ch; }
.help dt { color: var(--dim); }
.help dd { color: var(--text); }
.help-src { display: none; }
.no-js .help-src { display: block; margin-bottom: 16px; }

.risk, .help dd.risk { color: var(--warn); }

/* ---- install block ---- */
.cmd {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border: 2px solid var(--line);
    background: var(--code);
}
.cmd code {
    padding: 8px 12px;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: anywhere;
    font: inherit;
    color: var(--text);
    scrollbar-width: thin;
}
.cmd .prompt { color: var(--dim); user-select: none; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 14px;
    background: var(--hi);
    color: var(--hi-ink);
    border: 0;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--value); color: var(--value-ink); }
.btn.alt { background: none; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.alt:hover { background: var(--hi); color: var(--hi-ink); }
.cmd .btn { border-left: 2px solid var(--line); }
.install .sub { margin-top: 12px; color: var(--dim); }
.install .actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- sections below the first screen ---- */
.block { padding-block: 22px; }
.block > .pane + .pane { margin-top: 28px; }

.table { display: grid; gap: 2px; }
.table .tr { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 3ch; }
.table .th { color: var(--title); border-bottom: 2px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.table .g { color: var(--ok); }
.table .r { color: var(--value); }

.steps { counter-reset: step; display: grid; gap: 14px; }
.steps > li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 4ch minmax(0, 1fr);
    gap: 12px;
    transition: opacity 0.25s ease-out;
}
.steps > li::before { content: counter(step) "."; color: var(--value); text-align: right; }
.steps > li.done { opacity: 0.7; }
.steps > li.next::before { content: ">" counter(step) "."; margin-left: -1ch; }
.steps h3 { font-size: inherit; font-weight: 400; color: var(--title); margin-bottom: 4px; }
.steps .cmd { margin-top: 8px; }

.faq details { border-top: 2px solid var(--line); }
.faq details:last-child { border-bottom: 2px solid var(--line); }
.faq summary { cursor: pointer; padding: 6px 10px; list-style: none; display: flex; gap: 2ch; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "[+]"; color: var(--value); }
.faq details[open] > summary::before { content: "[-]"; }
.faq summary:hover { background: var(--hi); color: var(--hi-ink); }
.faq summary:hover::before { color: var(--hi-ink); }
.faq .answer { padding: 4px 10px 14px calc(10px + 5ch); max-width: 78ch; }
.faq .answer p + p { margin-top: 10px; }

/* ---- plugin catalog ---- */
.page-head { padding-block: 30px 6px; }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1; font-weight: 400; }
.page-head p { margin-top: 10px; color: var(--dim); max-width: 64ch; }

.finder { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 18px 0 8px; }
.finder label { color: var(--title); }
.finder input {
    flex: 1;
    min-width: 220px;
    max-width: 440px;
    background: var(--code);
    color: var(--text);
    border: 2px solid var(--line);
    padding: 4px 10px;
    font: inherit;
    border-radius: 0;
}
.finder input::placeholder { color: var(--dim); opacity: 1; }
.finder .count { color: var(--dim); }

.group { margin-top: 26px; }
.group > h2 { color: var(--title); font-size: inherit; font-weight: 400; padding: 0 10px 4px; border-bottom: 2px solid var(--line); margin-bottom: 4px; }
.row .tags { color: var(--dim); }
.row:hover .tags, .row.open .tags { color: var(--hi-ink); }
.row .mark { display: inline-block; width: 3ch; }
.detail { padding: 10px 10px 18px 5ch; max-width: 92ch; }
.detail[hidden] { display: none; }
.detail ul { margin: 8px 0 0; display: grid; gap: 4px; }
.detail li { padding-left: 2ch; position: relative; }
.detail li::before { content: "-"; position: absolute; left: 0; color: var(--value); }
.empty { padding: 18px 10px; color: var(--dim); }

/* ---- prose pages ---- */
.prose { max-width: 72ch; }
.prose h2 { color: var(--title); font-size: inherit; font-weight: 400; margin: 26px 0 6px; }
.prose h2:first-child { margin-top: 0; }
.prose p + p { margin-top: 10px; }
.prose ul { margin: 8px 0; display: grid; gap: 4px; }
.prose li { padding-left: 2ch; position: relative; }
.prose li::before { content: "-"; position: absolute; left: 0; color: var(--value); }

/* ---- footer ---- */
.keys {
    background: var(--bar);
    color: var(--bar-ink);
}
.keys .wrap { display: flex; flex-wrap: wrap; gap: 4px 28px; padding-block: 6px; }
.keys kbd { font: inherit; background: var(--field); color: var(--text); padding: 0 6px; margin-right: 6px; }
.foot { padding-block: 22px 18px; }
.foot .links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-bottom: 12px; }
.foot p { color: var(--dim); max-width: 90ch; }
.foot p + p { margin-top: 6px; }

.dock { position: sticky; bottom: 0; z-index: 60; margin-top: auto; }
.notice {
    background: var(--field-deep);
    border-top: 3px double var(--line);
    padding: 6px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    align-items: center;
    justify-content: center;
}
.notice[hidden] { display: none; }
.notice p { max-width: 90ch; }

.to-top {
    position: fixed;
    right: 16px;
    bottom: 64px;
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* a quick one-time scan of the menu when the page opens */
@media (prefers-reduced-motion: no-preference) {
    .scan .row { animation: scan 0.5s ease-out both; animation-delay: calc(var(--i, 0) * 55ms); }
    @keyframes scan {
        0% { background: var(--hi); color: var(--hi-ink); }
        100% { background: transparent; }
    }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .caret { animation: none; }
}

/* ---- narrow screens ---- */
@media (max-width: 900px) {
    :root { --cell: 21px; }
    .screen {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "intro" "install" "menu" "help";
        padding-block: 18px;
    }
    .screen .side { display: contents; }
    .screen { grid-template-rows: none; }
    .menu-btn { display: flex; }
    .tabs {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bar);
        border-top: 2px solid var(--field);
        margin: 0;
    }
    .tabs.open { display: flex; }
    .tabs a { padding: 10px 16px; }
    .table .th { display: none; }
    .table .tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-bottom: 8px; }
    .table .c3 { grid-column: 1 / -1; }
    .table .c3::before { content: attr(data-label); color: var(--dim); }
    .detail { padding-left: 10px; }
    .keys .hint-keys { display: none; }
}

@media (max-width: 520px) {
    .wrap { padding-inline: 12px; }
    .pane { padding: 26px 12px 14px; }
    .cmd { grid-template-columns: minmax(0, 1fr); }
    .cmd .btn { border-left: 0; border-top: 2px solid var(--line); padding-block: 8px; }
    .brand span { display: none; }
    .to-top { right: 10px; bottom: 10px; }
}

@media print {
    :root { --field: #fff; --text: #000; --dim: #333; --line: #000; --bar: #fff; --bar-ink: #000; --title: #000; --value: #000; --ok: #000; --warn: #000; --hi: #000; --hi-ink: #fff; --code: #fff; }
    .top, .keys, .notice, .to-top, .progress, .skip, .btn, .finder { display: none !important; }
    body { font-size: 12pt; }
    .detail[hidden] { display: block; }
    .pane { break-inside: avoid; }
    a::after { content: " (" attr(href) ")"; font-size: 10pt; }
}

.bul, .detail ul { margin-top: 10px; display: grid; gap: 4px; }
.bul li, .detail li { padding-left: 2ch; position: relative; }
.bul li::before, .detail li::before { content: "-"; position: absolute; left: 0; color: var(--value); }
.facts { margin-top: 14px; display: grid; grid-template-columns: max-content 1fr; gap: 2px 3ch; }
.facts dt { color: var(--dim); }
code { font: inherit; }
.rows .name .dim { margin-left: 1ch; }
@media (max-width: 700px) { .rows .name .dim { display: block; margin-left: 0; } }

.row:hover .dim, .row.open .dim, .row[aria-current="true"] .dim { color: var(--hi-ink); }

.row:focus-visible { outline-color: var(--hi-ink); }
.top :focus-visible { outline-color: var(--bar-ink); }

.gap8 { height: 8px; }
.lead60 { margin-top: 14px; max-width: 60ch; }
.lead70 { margin-bottom: 14px; max-width: 70ch; }
.lead72 { margin-bottom: 16px; max-width: 72ch; }
.lead76 { max-width: 76ch; }
.mt10 { margin-top: 10px; }
.row.static { cursor: default; }
.display.big { font-size: clamp(3rem, 10vw, 6rem); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.risk-line { color: var(--warn); }
.risk-line a { color: var(--warn); }
.risk-line a:hover { background: var(--hi); color: var(--hi-ink); }
.seg { white-space: nowrap; }
.install .cmd { grid-template-columns: minmax(0, 1fr); }
.install .cmd .btn { border-left: 0; border-top: 2px solid var(--line); padding-block: 6px; }

.mock { border: 2px solid var(--line); background: var(--code); padding: 8px 12px; margin-top: 12px; display: grid; gap: 2px; }
.mock-l { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1ch; }
.mock img { width: 22px; height: 22px; display: block; }
.cap { margin-top: 6px; }
.help .mock + .cap + dl, .help .mock + dl { margin-top: 12px; }
progress { appearance: none; -webkit-appearance: none; width: 12ch; height: 14px; border: 2px solid var(--line); background: var(--field); vertical-align: middle; }
progress::-webkit-progress-bar { background: var(--field); }
progress::-webkit-progress-value { background: var(--ok); }
progress::-moz-progress-bar { background: var(--ok); }

.blurb { display: none; grid-column: 1 / -1; color: var(--dim); }
.row:hover .blurb, .row[aria-current="true"] .blurb { color: var(--hi-ink); }

.no-js .menu-btn { display: none; }

@media (max-width: 900px) {
    .screen .help { display: none; }
    .blurb { display: block; }
    .keys { display: none; }
    .fkey { display: none; }
    .no-js .tabs { display: flex; position: static; flex-direction: row; flex-wrap: wrap; border: 0; }
    .to-top { bottom: 16px; }
}
@media (pointer: coarse) { .fkey { display: none; } }
@media (max-width: 480px) { .seg { white-space: normal; } }

/* a row that has keyboard focus reads like the selected row, so focus is never invisible */
.row:focus-visible { background: var(--hi); color: var(--hi-ink); outline-color: var(--hi-ink); }
.row:focus-visible .val, .row:focus-visible .tags, .row:focus-visible .dim, .row:focus-visible .blurb { color: var(--hi-ink); }

/* the help pane keeps one height, so the install pane does not move under the pointer */
@media (min-width: 901px) {
    .help { min-height: 372px; }
}
.mock .cap { margin-top: 2px; }

.wallet { margin-top: 16px; }
.wallet-name { margin-bottom: 4px; }
.wallet .cmd code { font-size: inherit; }
