/* Mirage Console documentation: plain HTML and CSS, works offline, no script. */

/* the console's own font, shipped with the package next to this folder (UI/Fonts); monospace fallbacks otherwise */
@font-face {
    font-family: "Google Sans Code";
    src: url("../UI/Fonts/GoogleSansCode.ttf") format("truetype");
    font-weight: 300 800;
    font-display: swap;
}

/* the colors of the "Mirage" theme (images/logo.svg): a night sky, the green sun of the prompt on the horizon, and
   its reflections */
:root {
    --bg: #ffffff;
    --bg-soft: #f2f7f3;
    --bg-code: #edf3ef;
    --text: #15201a;
    --text-dim: #56645c;
    --border: #d5e2d9;
    --accent: #1f8a3a;          /* the green of the console's prompt, darker for a light page */
    --accent-soft: #e2f4e6;
    --link: #17753a;
    --note: #1f6f86;
    --note-bg: #e5f1f4;
    --tip: #1f8a3a;
    --tip-bg: #e6f5e9;
    --warning: #b25e00;
    --warning-bg: #fdf1e3;
    --console-bg: #0c0c0c;
    --console-text: #cccccc;
    --console-prompt: #4ec964;
    /* the theme itself, the same in both color schemes: the sidebar and the hero are its sky */
    --sky-top: #0e1a24;
    --sky-horizon: #12261c;
    --sun: #9cf5aa;
    --sky-text: #d7e3dc;
    --sky-dim: #8aa396;
    --sky-hover: rgba(156, 245, 170, 0.08);
    --sky-current: rgba(78, 201, 100, 0.18);
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Google Sans Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    --sidebar: 17rem;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1016;
        --bg-soft: #0f1820;
        --bg-code: #121e27;
        --text: #e2e9e5;
        --text-dim: #92a59a;
        --border: #1f2e37;
        --accent: #4ec964;
        --accent-soft: #12261c;
        --link: #8ce59a;
        --note: #6cc3d5;
        --note-bg: #10222c;
        --tip: #4ec964;
        --tip-bg: #12261c;
        --warning: #f0a04b;
        --warning-bg: #2a2015;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.6;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
    position: absolute;
    left: -999px;
    top: 0.5rem;
    background: var(--accent);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    z-index: 10;
}
.skip:focus { left: 0.5rem; }

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

.layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 2rem;
    /* the sky of the logo, and its horizon at the bottom */
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-horizon) 100%);
    border-right: 1px solid var(--sky-horizon);
    color: var(--sky-text);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
}

.brand-mark { width: 2.2rem; height: 2.2rem; border-radius: 7px; }

.version { margin: 0.25rem 0 1rem; color: var(--sky-dim); font-size: 0.85rem; }

.sidebar h2 {
    margin: 1.25rem 0 0.35rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sky-dim);
}

.sidebar ul { list-style: none; margin: 0; padding: 0; }

.sidebar li a {
    display: block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    color: var(--sky-text);
    text-decoration: none;
    font-size: 0.95rem;
}

.sidebar li a:hover { background: var(--sky-hover); color: #ffffff; }

.sidebar li a[aria-current="page"] {
    background: var(--sky-current);
    color: var(--sun);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--console-prompt);
}

main {
    padding: 2.5rem 3rem 2rem;
    max-width: 58rem;
}

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

h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 0.75rem; }
/* the reflections of the sun under the title, shorter and fainter each */
h1::after {
    content: "";
    display: block;
    width: 6rem;
    height: 0.9rem;
    margin-top: 0.5rem;
    background:
        linear-gradient(var(--accent), var(--accent)) 0 0 / 100% 3px no-repeat,
        linear-gradient(var(--accent), var(--accent)) 0.9rem 6px / 4.2rem 3px no-repeat,
        linear-gradient(var(--accent), var(--accent)) 1.8rem 12px / 2.4rem 3px no-repeat;
    opacity: 0.8;
}
h2 { font-size: 1.5rem; margin: 2.5rem 0 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
h2, h3 { scroll-margin-top: 1rem; }

.lead { font-size: 1.15rem; color: var(--text-dim); margin-top: 0; }

p, ul, ol, table, pre, figure { margin: 0 0 1rem; }
li { margin: 0.25rem 0; }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }

:not(pre) > code {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
    overflow-wrap: anywhere;
}

kbd {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--bg-soft);
    font-size: 0.85em;
    line-height: 1.4;
}

pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    line-height: 1.5;
}

/* what the console shows: its own colors */
pre.console, pre:has(> code.lang-console) {
    background: var(--console-bg);
    color: var(--console-text);
    border-color: #2a2a2a;
}
pre.console .prompt { color: var(--console-prompt); }
pre.console .warn { color: #f5e6a3; }
pre.console .err { color: #f14c4c; }

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

.table-wrap { overflow-x: auto; margin-bottom: 1rem; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-soft); font-weight: 600; }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; }

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

figure {
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    /* a screenshot not taken yet still takes some room, with its description in it */
    min-height: 6rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    background: repeating-linear-gradient(45deg, transparent 0 12px, var(--border) 12px 13px);
}

/* a click opens the screenshot at its full size */
figure a.zoom { display: block; cursor: zoom-in; }

figcaption { padding: 0.55rem 0.9rem; font-size: 0.9rem; color: var(--text-dim); border-top: 1px solid var(--border); }

figure.narrow { max-width: 32rem; }
/* a screenshot of a phone held upright */
figure.phone { max-width: 18rem; }

/* ---------- callouts, steps, cards ---------- */

.callout {
    border-left: 4px solid var(--note);
    background: var(--note-bg);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    margin: 1.25rem 0;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 0.5rem; }
.callout.tip { border-color: var(--tip); background: var(--tip-bg); }
.callout.warning { border-color: var(--warning); background: var(--warning-bg); }

ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1rem; }
ol.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 1.5rem;
}

.card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; color: var(--accent); margin-bottom: 0.2rem; }
.card span { color: var(--text-dim); font-size: 0.92rem; }

/* the sky of the logo, the glow of its sun on the horizon */
.hero {
    background:
        radial-gradient(ellipse 60% 55% at 85% 100%, rgba(78, 201, 100, 0.28), transparent 70%),
        linear-gradient(180deg, var(--sky-top) 0%, var(--sky-horizon) 100%);
    color: var(--sky-text);
    border-radius: 10px;
    padding: 1.5rem 1.75rem;
    margin: 0 0 1.5rem;
    overflow: hidden;
}
.hero-logo { float: right; width: 6.5rem; height: 6.5rem; margin: 0 0 0.75rem 1.25rem; border-radius: 16px; }
.hero p { margin: 0 0 0.6rem; }
.hero .tagline { font-size: 1.2rem; color: #fff; font-weight: 600; }
.hero code { background: transparent; border: 0; color: var(--console-prompt); padding: 0; }
/* the two ways into the tutorial, for who just installed the package */
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 0; }
.hero .action {
    display: inline-block;
    padding: 0.45rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.hero .action:hover { background: rgba(255, 255, 255, 0.18); border-color: #fff; }
.hero .action:first-child { background: rgba(78, 201, 100, 0.35); border-color: rgba(78, 201, 100, 0.9); }

.toc {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0 0 1.5rem;
    background: var(--bg-soft);
}
.toc p { margin: 0 0 0.3rem; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.toc ul { margin: 0; padding-left: 1.1rem; columns: 2; column-gap: 2rem; }
.toc li { margin: 0.15rem 0; break-inside: avoid; }

/* ---------- pager and footer ---------- */

.pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 3rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.pager a { text-decoration: none; font-weight: 600; }

footer { color: var(--text-dim); font-size: 0.85rem; padding: 1rem 0 2rem; }

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

@media (max-width: 860px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar li a { padding: 0.2rem 0.5rem; font-size: 0.9rem; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--sky-horizon); }
    .hero-logo { width: 4.5rem; height: 4.5rem; }
    .sidebar ul { display: flex; flex-wrap: wrap; gap: 0.25rem; }
    main { padding: 1.5rem 1rem 2rem; }
    h1 { font-size: 1.7rem; }
    .toc ul { columns: 1; }
}

@media print {
    .sidebar, .pager, .skip, .hero-logo { display: none; }
    .layout { display: block; }
    main { max-width: none; padding: 0; }
    figure, pre, table { break-inside: avoid; }
}
