/* Global appearance rules, loaded on every page after the shell's CSS (plan §4.2).
   Owned by the groundwork agent.

   Each rule either keys on an attribute the runtime sets only for a non-default setting, or
   reads a variable whose fallback is the value the page had before Settings → Appearance. With
   the runtime absent, the page looks exactly as it did. Rules for one module's elements live in
   that module's own CSS (sessions: workspace.css), where its class audit can see them. */

/* The code font. The shell's frozen .font-mono hard-codes the Geist Mono stack; this reads
   --font-mono, whose token value (and fallback) is that same stack. In the utilities layer and
   after the shell's sheet, so it replaces that rule and nothing else. */
@layer utilities {
	.font-mono {
		font-family: var(--font-mono, "Geist Mono Variable", "Geist Mono", ui-monospace, monospace);
	}
}

/* Word wrap off: code blocks, tool output and diffs keep their lines and scroll sideways.
   On (the default) is the pages' own behaviour, which already varies: tool output, command
   lines, the Markdown fallbacks, the dock's output and an edit's diff preview wrap; Markdown
   code blocks, Markdown tables, the git diff view and the file and output viewers never wrap
   and scroll instead. A <pre> that is already white-space: pre (the file viewer's, which
   lines up with its own gutter) is left alone. */
html[data-word-wrap="off"] pre:not(.whitespace-pre) {
	white-space: pre;
	overflow-wrap: normal;
	word-break: normal;
	overflow-x: auto;
}

/* An edit's diff preview (sessions Conversation.tsx EditPreview): rows are lines. The grid's
   one column is as wide as the longest line (or the box, when that is wider), so every row's
   tint runs the full scroll width. */
html[data-word-wrap="off"] [data-edit-line] {
	white-space: pre;
	overflow-wrap: normal;
	word-break: normal;
}

html[data-word-wrap="off"] [data-edit-lines] {
	display: grid;
	grid-template-columns: minmax(max-content, 1fr);
}

/* Font smoothing off: the browser's default rendering (subpixel where the platform has it).
   Nothing in the shell or the modules applies antialiased today, so "on" (the default) is
   the same rendering as before; this also undoes a .antialiased if one appears. */
html[data-font-smoothing="off"],
html[data-font-smoothing="off"] .antialiased {
	-webkit-font-smoothing: auto;
	-moz-osx-font-smoothing: auto;
}

/* The runtime adds this class for one frame while it applies a change made elsewhere (another
   tab, the OS), so colours and panels switch at once instead of animating. */
html.medusa-theme-switching,
html.medusa-theme-switching *,
html.medusa-theme-switching *::before,
html.medusa-theme-switching *::after {
	transition: none !important;
}

/* Interface font size zooms <body> (plan D9), and viewport units are zoomed with it: the shell's
   100vh frame would run past the screen's bottom at 1.25 and stop short of it at 0.75. These are
   the shell's own rules (index.html) divided by --shell-zoom, which the runtime sets beside the
   zoom; unset, each is exactly the shell's value. `html` outranks the shell's selectors. */
html body {
	min-height: calc(100vh / var(--shell-zoom, 1));
}

html body.authed nav {
	height: calc(100vh / var(--shell-zoom, 1));
}

html #outlet {
	min-height: calc((100vh - var(--vygen-offline-banner-h, 0px)) / var(--shell-zoom, 1));
}

html .shell-settings {
	flex-basis: calc((100dvh - var(--vygen-offline-banner-h, 0px)) / var(--shell-zoom, 1));
	height: calc((100dvh - var(--vygen-offline-banner-h, 0px)) / var(--shell-zoom, 1));
	max-height: calc((100dvh - var(--vygen-offline-banner-h, 0px)) / var(--shell-zoom, 1));
}
