/* Sector F Labs' look for the stagit pages, as close to sectorflabs.com as plain CSS on stagit's
   fixed markup gets: the page is drawn as a Patina window (rounded, bordered, shadowed, on a
   darker desktop), the header table is the title bar, Log | Files | Refs ... are bar buttons,
   the content scrolls inside the window and the footer is its status bar.
   Colours are the website's default skin, Patina's everforest-dark (copied from
   website/docs/skins.css, which the site build generates from Patina's skins/everforest-dark.toml;
   dark only, like the site), and the fonts are the same: Ubuntu Light and Hack. Self-contained,
   because this site is a separate origin from sectorflabs.com. */

@font-face { font-family: "Ubuntu Light"; src: url("/fonts/Ubuntu-Light.ttf") format("truetype"); font-weight: 100 600; font-display: swap; }
@font-face { font-family: "Hack"; src: url("/fonts/Hack-Regular.ttf") format("truetype"); font-display: swap; }

:root {
	color-scheme: dark;
	--desktop: color-mix(in srgb, #2D353B, #000 45%);
	--bg: #2D353B; --surface: #272E33; --surface-alt: #343F44; --border: #3D484D;
	--text: #D3C6AA; --text-strong: #E6E2DC; --text-weak: #859289;
	--accent: #A7C080; --accent-text: #2D353B; --link: #7FBBB3;
	--title-bar: #272E33; --bar-text: #D3C6AA; --bar-hover: #475258;
	--add: #A7C080; --del: #E67E80; --hunk: #83C092;
	--radius: 6px; --win-radius: 15px;
	--shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
	--mono: "Hack", ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* overflow: hidden here keeps body's own overflow from being passed up to the viewport, which
   would stop body clipping its children to the rounded corners (the title bar and status bar
   would poke out square). The window never needs the page to scroll; #content does. */
html { overflow: hidden; background: var(--desktop); -webkit-text-size-adjust: 100%; scrollbar-color: var(--border) transparent; }
::selection { background: var(--accent); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- The window ---------------------------------------------------------------------- */

body {
	margin: 0 auto; padding: 0;
	width: calc(100% - 48px); max-width: 1240px;
	height: calc(100dvh - 48px); margin-block: 24px;
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--bg); color: var(--text);
	border: 1px solid var(--border); border-radius: var(--win-radius); box-shadow: var(--shadow);
	font: 16px/1.6 "Ubuntu Light", "Ubuntu", system-ui, sans-serif;
}

/* Status bar. */
body::after {
	content: "Sector F Labs"; flex: none;
	padding: 4px 12px; border-top: 1px solid var(--border);
	background: var(--title-bar); color: var(--text-weak); font-size: 14px; line-height: 1.6;
}

/* ---- The title bar: stagit's header table ----------------------------------------------
   Row 1: the logo, the repository's name and description, and the Log | Files | ... links as
   buttons on the right. Row 2: the clone command. The index page has the same shape. */

body > table, body > table tbody { display: contents; }
body > table { flex: none; }
body > table tbody { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 8px;
	flex: none; padding: 8px 12px; background: var(--title-bar); border-bottom: 1px solid var(--border); }
body > table tr { display: contents; }
body > table td { padding: 0; font-size: 15px; line-height: 25px; }
body > table tr:not(.url):nth-child(2) td,            /* the index page's empty row */
body > table tr.url td:first-child,
body > table tr:nth-child(3) td:first-child { display: none; }

body > table img { display: block; width: 20px; height: 20px; }
body > table h1, body > table .desc { display: inline; font-size: 15px; font-weight: normal; }
body > table h1 { color: var(--text-strong); margin-right: 8px; }
.desc { color: var(--text-weak); }
body > table td:nth-child(2) { min-width: 0; }

/* Log | Files | Refs | README | LICENSE: the bar buttons. The " | " between them is text,
   so the cell's own size is zero and the links bring theirs. */
body > table tr:nth-child(3) td:nth-child(2) { grid-column: 3; grid-row: 1; display: flex; gap: 4px; font-size: 0; }
body > table tr:nth-child(3) a {
	display: block; padding: 0 8px; font-size: 15px;
	border-radius: var(--radius); color: var(--bar-text);
	background: color-mix(in srgb, var(--bar-text) 12%, transparent);
}
body > table tr:nth-child(3) a:hover { background: var(--bar-hover); text-decoration: none; }

body > table tr.url td { grid-column: 2 / 4; font: 14px/1.5 var(--mono); color: var(--text-weak); padding-top: 4px; overflow-x: auto; white-space: nowrap; }

body > hr { display: none; }
#content hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0 12px; }

/* ---- The page: scrolls inside the window ----------------------------------------------- */

#content { flex: 1; min-height: 0; overflow: auto; padding: 16px 24px 24px; scrollbar-color: var(--border) transparent; }

h1, h2, h3 { color: var(--text-strong); font-weight: normal; margin: 0; line-height: 1.3; }
h2 { font-size: 18px; margin: 1.2em 0 .4em; }

/* The log, files, refs and index tables. */
#content table { width: 100%; border-collapse: collapse; }
#content td { padding: 4px 16px 4px 0; vertical-align: top; }
#content thead td { color: var(--text-weak); border-bottom: 1px solid var(--border); position: sticky; top: -16px; background: var(--bg); }
#content thead b { font-weight: normal; }
#content thead td.num { font: inherit; }
#content tbody tr:hover { background: var(--surface-alt); }
#content tbody td { border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 60%); }
td.num { text-align: right; white-space: nowrap; font: 14px var(--mono); }
#log td:first-child, #log td:nth-child(3), #files td:first-child { white-space: nowrap; }
#files td:first-child { font: 14px var(--mono); color: var(--text-weak); }

/* Code: file views, commits and diffs, like the site's code blocks. */
pre {
	margin: 0 0 12px; padding: 12px 16px; overflow-x: auto;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	font: 14px/1.5 var(--mono); color: var(--text);
}
pre a.line { color: var(--text-weak); display: inline-block; min-width: 4ch; margin-right: 1.5ch; text-align: right; user-select: none; }
pre a.h, .h { color: var(--hunk); }
.i, pre a.i { color: var(--add); }
.d, pre a.d { color: var(--del); }
pre b { color: var(--text-strong); font-weight: normal; }

@media (max-width: 640px) {
	body { width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; font-size: 15px; }
	#content { padding: 12px; }
	body > table tbody { grid-template-columns: auto 1fr; }
	body > table tr:nth-child(3) td:nth-child(2) { grid-column: 1 / 3; grid-row: 3; flex-wrap: wrap; padding-top: 6px; }
	body > table tr.url td { grid-column: 1 / 3; }
}
