/* The Mosaicus website: the app's own dark, quiet look (src/styles.css), at a size for reading. */
:root {
  --bg0: #141417;
  --bg1: #1c1c21;
  --bg2: #24242a;
  --bg3: #2e2e36;
  --line: #34343d;
  --line2: #44444f;
  --text: #e4e4ea;
  --text2: #a4a4b0;
  --text3: #8c8c98;
  --accent: #7c8cff;
  --accent2: #5b6be0;
  --warn: #f0b04a;
  --ok: #6fd08c;
  --radius: 6px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --bar: 44px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar) + 12px); }
body { margin: 0; background: var(--bg0); color: var(--text); font: 15px/1.65 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
button { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- the bar (the app's menu bar) */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 4px; padding: 0 16px;
  background: var(--bg1); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; margin-right: 14px; color: var(--text); font-weight: 600; letter-spacing: 0.02em; font-size: 15px; }
.brand:hover { text-decoration: none; }
.mark { display: inline-grid; grid-template-columns: repeat(2, 7px); gap: 1px; }
.mark b { width: 7px; height: 7px; border-radius: 1.5px; }
.menus { display: flex; gap: 2px; }
.menus a { color: var(--text); padding: 5px 11px; border-radius: 4px; font-size: 14px; }
.menus a:hover { background: var(--bg3); text-decoration: none; }
.menus a[aria-current='page'] { background: var(--bg3); }
.search { margin-left: auto; width: 240px; }
.nav-toggle { display: none; background: none; border: 0; font-size: 18px; padding: 4px 10px; margin-left: -8px; cursor: pointer; color: var(--text2); }

kbd {
  font: 12px/1 var(--font); padding: 3px 6px; border-radius: 4px; white-space: nowrap;
  background: var(--bg3); border: 1px solid var(--line2); border-bottom-width: 2px; color: var(--text);
}

/* ---------------------------------------------------------------- the page */
.page { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
.page.with-side { grid-template-columns: 270px minmax(0, 1fr); }
.page.with-side.with-toc { grid-template-columns: 270px minmax(0, 1fr) 220px; }
main { min-width: 0; padding: 28px 48px 48px; }
.help main { max-width: 900px; }

/* the help's contents (the app's side panel, on the left) */
.sidenav {
  position: sticky; top: var(--bar); align-self: start; height: calc(100vh - var(--bar)); overflow-y: auto;
  background: var(--bg1); border-right: 1px solid var(--line); padding: 0 8px 24px; font-size: 14px;
}
.panel-head {
  padding: 14px 10px 8px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2);
}
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav ul ul { padding-left: 12px; margin-left: 10px; border-left: 1px solid var(--line); }
.sidenav a { display: block; padding: 3px 10px; border-radius: 4px; color: var(--text2); line-height: 1.4; }
.sidenav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidenav a[aria-current='page'] { background: var(--accent2); color: white; }
.sidenav .help-home { margin-bottom: 2px; }
.sidenav details > summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.sidenav details > summary::-webkit-details-marker { display: none; }
.sidenav details > summary::before {
  content: '›'; flex: none; width: 14px; margin-left: -4px; text-align: center; color: var(--text3); transition: transform 0.15s;
}
.sidenav details[open] > summary::before { transform: rotate(90deg); }
.sidenav details > summary > a { flex: 1; padding-left: 4px; }
.sidenav > ul > li { margin-top: 2px; }
.sidenav > ul > li > details > summary > a { color: var(--text); font-weight: 600; }
.sidenav > ul > li > details > summary > a[aria-current='page'] { color: white; }

/* on this page (the right column) */
.toc { position: sticky; top: var(--bar); align-self: start; max-height: calc(100vh - var(--bar)); overflow-y: auto; padding: 28px 16px 24px 8px; font-size: 13px; }
.toc h2 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2); }
.toc ul { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 3px 0; color: var(--text3); line-height: 1.35; }
.toc a:hover { color: var(--text); text-decoration: none; }

.crumbs { font-size: 13px; color: var(--text3); margin-bottom: 6px; }
.crumbs a { color: var(--text2); }
.crumbs .sep { margin: 0 7px; color: var(--text3); }

/* ---------------------------------------------------------------- the text */
article h1 { font-size: 30px; line-height: 1.2; margin: 0 0 14px; font-weight: 650; letter-spacing: -0.01em; }
article h2 { font-size: 21px; line-height: 1.3; margin: 38px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); font-weight: 600; }
article h3 { font-size: 17px; margin: 28px 0 6px; font-weight: 600; }
article h4 { font-size: 15px; margin: 20px 0 4px; font-weight: 600; color: var(--text2); }
article h1 + h2, article > h2:first-child { border-top: 0; }
.anchor { float: left; margin-left: -1em; width: 1em; color: var(--text3); opacity: 0; font-weight: 400; }
:is(h2, h3, h4):hover > .anchor, .anchor:focus { opacity: 1; text-decoration: none; }
article p, article ul, article ol { margin: 0 0 14px; }
article ul, article ol { padding-left: 24px; }
article li { margin: 3px 0; }
article li > ul, article li > ol { margin: 4px 0; }
article strong { color: #fff; font-weight: 600; }
article .lead { font-size: 17px; color: var(--text2); margin-bottom: 22px; }
article code { font: 0.88em var(--mono); background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
article pre { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; line-height: 1.5; }
article pre code { background: none; border: 0; padding: 0; font-size: 13px; }
article hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
article img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--line2); box-shadow: 0 8px 24px rgb(0 0 0 / 0.35); }
article figure { margin: 18px 0 22px; }
article figure img { margin: 0; }
article figcaption { margin-top: 8px; font-size: 13px; color: var(--text3); }
article p > img { margin: 18px 0; }
/* (a picture at the C64's own pixels: kept sharp) */
/* (a picture of C64 pixels: drawn sharp only where each of its pixels is a whole number of the screen's (site.js
   adds .sharp); scaled any other way, sharp drawing makes pixels uneven and dither patterns striped, so it's
   smoothed. A click shows it larger, sharp.) */
img.sharp { image-rendering: pixelated; }
:is(article img.pixels, article figure.pixels img, .formats img, .features img) { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / 0.95); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { display: block; max-width: none; border: 1px solid var(--line2); border-radius: 4px; box-shadow: 0 16px 48px rgb(0 0 0 / 0.5); }
.lightbox figcaption { color: var(--text2); font-size: 14px; text-align: center; max-width: 720px; }
.lightbox figcaption b { display: block; color: var(--text); }

.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius); }
article table { border-collapse: collapse; width: 100%; font-size: 14px; }
article th, article td { text-align: left; vertical-align: top; padding: 7px 12px; border-bottom: 1px solid var(--line); }
article th { background: var(--bg1); color: var(--text2); font-weight: 600; font-size: 13px; }
article tr:last-child td { border-bottom: 0; }
@media (min-width: 861px) { article td:first-child { white-space: nowrap; } }
/* (a narrow table scrolls in its frame rather than breaking a value such as 320 × 200 in two) */
article td, article th { min-width: 5.5em; }

.callout { margin: 16px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--bg1); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.callout p:last-child { margin-bottom: 0; }
.callout-title { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 2px; }
.callout.tip { border-left-color: var(--ok); }
.callout.tip .callout-title { color: var(--ok); }
.callout.warning { border-left-color: var(--warn); }
.callout.warning .callout-title { color: var(--warn); }
blockquote:not(.callout) { margin: 16px 0; padding: 2px 16px; border-left: 3px solid var(--line2); color: var(--text2); }

/* the help's contents page: its sections as cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 18px 0 24px; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; padding: 14px 16px; border-radius: 10px; background: var(--bg1); border: 1px solid var(--line); color: var(--text); }
.cards a:hover { border-color: var(--accent); text-decoration: none; background: var(--bg2); }
.cards b { display: block; font-size: 15px; margin-bottom: 3px; }
.cards span { display: block; font-size: 13px; color: var(--text2); line-height: 1.45; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager a { flex: 0 1 48%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg1); color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .next { text-align: right; margin-left: auto; }
.pager small { display: block; font-size: 12px; color: var(--text3); }

/* buttons (the app's) */
.btn { display: inline-block; padding: 8px 18px; border-radius: var(--radius); background: var(--bg3); border: 1px solid var(--line2); color: var(--text); font-size: 15px; }
.btn:hover { background: var(--line2); text-decoration: none; }
.btn.primary { background: var(--accent2); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent); }
.btn[aria-disabled='true'] { opacity: 0.55; pointer-events: none; }

.hint { color: var(--text3); font-size: 13px; }

/* ---------------------------------------------------------------- the home page */
.home main { padding: 0; }
/* (a page of its own, not the help's: the download page) */
.single main { width: 100%; max-width: 920px; margin: 0 auto; padding: 36px 40px 56px; }
@media (max-width: 860px) { .single main { padding: 24px 16px 40px; } }
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: center; max-width: 1240px; margin: 0 auto; padding: 64px 40px 40px; }
.hero h1 { font-size: 46px; line-height: 1.08; margin: 0 0 16px; letter-spacing: -0.02em; border: 0; padding: 0; text-wrap: balance; }
.hero .lead { font-size: 19px; line-height: 1.55; color: var(--text2); margin: 0 0 18px; }
.hero .points { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 10px; }
.hero .points li { position: relative; padding-left: 18px; color: var(--text2); line-height: 1.55; }
.hero .points li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 7px; height: 7px; border-radius: 1.5px; background: var(--accent); }
.hero .points b { color: var(--text); }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero .actions .hint { flex-basis: 100%; margin: 4px 0 0; }
.hero img { width: 100%; }
.section { max-width: 1240px; margin: 0 auto; padding: 32px 40px; }
.section > h2 { font-size: 26px; margin: 0 0 6px; border: 0; padding: 0; }
.section > p.sub { color: var(--text2); margin: 0 0 22px; max-width: 760px; }
/* (the features with a screenshot two to a row, the others three; one to a row on a phone) */
.features { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; }
.features li { grid-column: span 2; margin: 0; padding: 16px 18px; border-radius: 10px; background: var(--bg1); border: 1px solid var(--line); }
.features li.pic { grid-column: span 3; overflow: hidden; }
@media (max-width: 860px) { .features li { grid-column: span 6; } .features li.pic { grid-column: span 3; } }
@media (max-width: 600px) { .features li.pic { grid-column: span 6; } }
.features figure { margin: -16px -18px 14px; border-bottom: 1px solid var(--line); background: #000; }
.features img { display: block; width: 100%; height: auto; }
.features figcaption { padding: 8px 18px 9px; font-size: 13px; line-height: 1.5; color: var(--text3); background: var(--bg2); }
.features h3 { margin: 0 0 6px; font-size: 16px; }
.features p { margin: 0; font-size: 14px; color: var(--text2); line-height: 1.55; }
.formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.formats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 960px) { .formats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .formats, .formats.two { grid-template-columns: minmax(0, 1fr); } }
.formats figure { display: flex; flex-direction: column; margin: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
/* (a sample snapped to whole screen pixels a C64 pixel: its own size, centered on black) */
.formats img.snapped { aspect-ratio: auto; height: auto; margin: 0 auto; }
.formats img { display: block; width: 100%; height: auto; border: 0; border-radius: 0; box-shadow: none; aspect-ratio: 16 / 10; object-fit: contain; background: #000; }
.formats figcaption { padding: 10px 14px 12px; font-size: 14px; color: var(--text2); background: var(--bg1); flex: 1; }
.formats figcaption b { display: block; color: var(--text); font-size: 15px; }
/* figures side by side (samples, before and after): each at its own size, never wider than its column */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 0 16px; align-items: start; margin: 6px 0 10px; }
.figs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figs.wide { grid-template-columns: minmax(0, 1fr); }
.figs figure { margin: 10px 0 14px; }
.figs img { width: auto; max-width: 100%; }
.shot { margin: 0; }
.shot img { border-radius: 10px; }

/* ---------------------------------------------------------------- the footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--bg1); color: var(--text3); font-size: 13px; }
.foot a { color: var(--text2); }
.foot-links { display: flex; gap: 18px; }

/* ---------------------------------------------------------------- the search (Pagefind; the app's dialog) */
[data-pf-theme='dark'] {
  --pf-text: var(--text);
  --pf-text-secondary: var(--text2);
  --pf-text-muted: var(--text3);
  --pf-background: var(--bg2);
  --pf-border: var(--line2);
  --pf-border-focus: var(--accent);
  --pf-hover: var(--bg3);
  --pf-mark: #c3cbff; /* (a match in the results: its text, bright) */
  --pf-skeleton: var(--bg3);
  --pf-skeleton-shine: var(--line2);
  --pf-outline-focus: var(--accent);
  --pf-font: var(--font);
  --pf-border-radius: 6px;
  --pf-modal-backdrop: rgb(0 0 0 / 0.55);
  --pf-shadow-lg: 0 16px 48px rgb(0 0 0 / 0.5);
}
.search pagefind-modal-trigger { display: block; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1180px) {
  .page.with-side.with-toc { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  :root { --bar: 48px; }
  .page.with-side, .page.with-side.with-toc { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: block; }
  .sidenav { position: fixed; top: var(--bar); left: 0; bottom: 0; height: auto; width: min(300px, 86vw); z-index: 15; transform: translateX(-100%); transition: transform 0.18s; box-shadow: 8px 0 24px rgb(0 0 0 / 0.4); }
  body.nav-open .sidenav { transform: none; }
  main { padding: 20px 16px 40px; }
  /* (the search: its icon alone; the page's own width for the rest) */
  .search { width: auto; margin-left: auto; }
  .search .pf-trigger-text, .search .pf-trigger-shortcut { display: none !important; }
  .brand { margin-right: 6px; }
  .figs.two { grid-template-columns: minmax(0, 1fr); }
  /* (one column: the screenshot right under the headline, the text's other parts after it) */
  .hero { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 36px 16px 20px; }
  .hero > div { display: contents; }
  .hero h1 { font-size: 34px; order: -2; }
  .hero .shot { order: -1; margin: 4px 0 22px; }
  .section { padding: 24px 16px; }
  article h1 { font-size: 26px; }
  .anchor { display: none; }
}

/* ---------------------------------------------------------------- the download page: a file, its size and SHA-256 */
.dl { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 10px 0 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); }
.dl .dl-name { font-weight: 600; overflow-wrap: anywhere; }
.dl .dl-size { color: var(--text3); font-size: 14px; }
.dl .dl-sha { flex-basis: 100%; padding: 0; border: 0; background: none; color: var(--text3); font-size: 12px; overflow-wrap: anywhere; }
