/* mortar.ch. BitsAndBricks colours and fonts, laid out like mason's web app: a terminal screen with a
   prompt bar, numbered tabs and a status line. Fonts: Archivo and IBM Plex Mono (SIL OFL 1.1), served from here. */
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%; src: url(fonts/archivo-latin-standard-normal.woff2) format("woff2-variations"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }

:root {
  --page: #f7f7f4; --bar: #efefea; --sel: #f6e4dc; --code: #efefea;
  --line: #e1e1da; --line-2: #cbcbc2;
  --text: #151515; --text-2: #4a4a46; --text-3: #686862;
  --green: #15803d; --core: #22c55e; --brick: #b23b14; --mark-bg: #111111; --mark-brick: #f27a4f; --mark-green: #43a868;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #111111; --bar: #1a1a1a; --sel: #2a1d17; --code: #1a1a1a;
    --line: #2e2e2e; --line-2: #424242;
    --text: #ededed; --text-2: #b3b3b3; --text-3: #8c8c8c;
    --green: #5cb97c; --core: #43a868; --brick: #f27a4f; --mark-bg: #212121;
  }
}
:root[data-theme="dark"] {
  --page: #111111; --bar: #1a1a1a; --sel: #2a1d17; --code: #1a1a1a;
  --line: #2e2e2e; --line-2: #424242;
  --text: #ededed; --text-2: #b3b3b3; --text-3: #8c8c8c;
  --green: #5cb97c; --core: #43a868; --brick: #f27a4f; --mark-bg: #212121;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 90px; }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.65 var(--mono); -webkit-font-smoothing: antialiased; }
a { color: var(--brick); text-underline-offset: .2em; }
a:hover { color: var(--text); }
:focus-visible { outline: 1px dashed var(--brick); outline-offset: 2px; }
::selection { background: var(--brick); color: #fff; }
svg { display: block; }
code { font-family: var(--mono); color: var(--text); }
.dim { color: var(--text-3); }
.spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } html { scroll-behavior: auto; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* The screen: prompt bar, tabs, the page, status line */
.screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: minmax(0, 1fr); }
.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 7px 16px;
  background: var(--bar); border-bottom: 1px solid var(--line); font-size: .85rem; white-space: nowrap; }
.who b { color: var(--brick); font-weight: 600; }
.theme { font: inherit; background: transparent; color: var(--text-2); border: 1px solid var(--line-2); padding: 2px 9px; cursor: pointer; }
.theme:hover { border-color: var(--brick); color: var(--brick); }
.k { color: var(--brick); margin-right: 6px; }
.tabs { position: sticky; top: 38px; z-index: 2; display: flex; gap: 2px; padding: 0 10px; background: var(--bar);
  border-bottom: 1px solid var(--line); overflow-x: auto; font-size: .85rem; }
.tabs a { padding: 7px 10px; color: var(--text-3); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover, .tabs a.on { color: var(--text); border-bottom-color: var(--brick); }

main { width: min(820px, 100%); margin: 0 auto; padding: 0 16px 40px; }
main > section { padding: 36px 0 8px; }
main > section:last-child { min-height: calc(100vh - 150px); min-height: calc(100dvh - 150px); }
main > section + section { border-top: 1px dashed var(--line-2); margin-top: 28px; }
main p { margin: 0 0 14px; color: var(--text-2); max-width: 68ch; }

.prompt { margin: 0 0 14px; font: 400 .85rem/1.4 var(--mono); color: var(--text-3); }
.prompt b { color: var(--brick); font-weight: 600; }
h2.prompt { font-size: .85rem; }

/* MOTD */
.motd { padding-top: clamp(36px, 8vw, 64px) !important; }
.mark { width: 44px; height: 44px; margin-bottom: 20px; }
.m-bg { fill: var(--mark-bg); } .m-b { fill: var(--mark-brick); } .m-j { fill: var(--mark-green); }
h1 { margin: 0 0 12px; font-family: var(--sans); font-stretch: 125%; font-weight: 800; font-size: clamp(2.6rem, 11vw, 4.4rem);
  line-height: 1; letter-spacing: -.02em; }
h1 span { color: var(--brick); }
.lede { font-size: 1.05rem; color: var(--text) !important; margin-bottom: 18px !important; }
.cursor { display: inline-block; width: .6em; height: 1.1em; background: var(--core); vertical-align: -.2em; margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Tools: a mason-style table, the selected row's detail under it */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 400; color: var(--text-3); border-bottom: 1px solid var(--line-2); padding: 4px 10px; }
.table td { padding: 6px 10px; border-bottom: 1px dotted var(--line); vertical-align: top; color: var(--text-2); }
.table td:last-child { white-space: nowrap; }
.table .name { font-weight: 600; color: var(--text); white-space: nowrap; }
.table tr.sel td { background: var(--sel); }
.table tr.sel td:first-child::before { content: "▸ "; color: var(--brick); }
.detail { margin-top: 22px; padding: 18px 20px; border: 1px solid var(--line-2); }
.detail h3 { margin: 0 0 10px; font: 600 .95rem/1.3 var(--mono); color: var(--brick); }
.detail h3::before { content: "### "; color: var(--text-3); font-weight: 400; }
.kv { display: grid; grid-template-columns: 8ch 1fr; gap: 6px 14px; margin: 0 0 18px; font-size: .9rem; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-2); }
pre.code { margin: 0; padding: 12px 14px; background: var(--code); border-left: 2px solid var(--brick); overflow-x: auto; font-size: .82rem; line-height: 1.6; }

/* The name: a man page */
.man { margin: 0; }
.man dt { font-weight: 600; color: var(--text); font-size: .85rem; letter-spacing: .04em; }
.man dd { margin: 2px 0 16px 4ch; color: var(--text-2); max-width: 64ch; }
.man dd b { color: var(--brick); }

/* Status line */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 8px 16px; background: var(--bar);
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--text-3); }
.status { display: inline-flex; align-items: center; gap: 8px; }
.led { width: 8px; height: 8px; border-radius: 1px; background: var(--core); }
.keys b { color: var(--brick); font-weight: 400; }
.powered { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); text-decoration: none; }
.powered svg { width: 18px; height: 18px; }
.powered .b { fill: var(--mark-brick); } .powered .g { fill: var(--mark-green); } .powered .p { fill: var(--bar); }
.powered strong { font: 800 .85rem/1 var(--sans); font-stretch: 125%; color: var(--text); letter-spacing: -.01em; }
.powered strong b { color: var(--green); font-weight: 800; }
.powered:hover strong { color: var(--brick); }

@media (max-width: 620px) {
  body { font-size: 14px; }
  .top .cmd, .keys { display: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table td { border: 0; padding: 2px 10px; }
  .table tr { padding: 8px 0; border-bottom: 1px dotted var(--line); }
  .table tr.sel { background: var(--sel); }
  .table tr.sel td { background: none; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .detail { padding: 14px; }
  .man dd { margin-left: 2ch; }
}
