/* ─────────────────────────────────────────────────────────────────────────
   groundkeep.app — the ONE shared stylesheet.

   Every page on the site links this file first, then carries only its own
   page-specific rules inline. It holds what every page has in common: the
   Geist faces, the design tokens, the page shell, base type, buttons, cards,
   form fields, and the shared header and footer that landing/build-site.mjs
   injects into every page.

   2026-10-13: rebuilt for the Cloud-first redesign (design handoff
   docs/03-design-system.md). The tokens below are the handoff's, named as it
   names them. The `--color-*` names further down are the PREVIOUS design's
   tokens, kept as aliases onto the new ones: every guide, tool, legal page and
   the contact page still styles its own content with them, and until those
   pages are redesigned (later phases) the aliases are what gives them the new
   palette without touching their content.

   Referenced root-relative (/assets/site.css) from every page, because the
   404 page is served at any depth. url()s in here resolve against THIS file,
   so the fonts are ../fonts/, whatever page loads it.

   No third-party request: same origin, no CDN.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Geist and Geist Mono ───────────────────────────────────────────────
   Variable fonts (one file each, every weight), SIL Open Font License —
   see fonts/GEIST-LICENSE.txt. The site uses 400, 500 and 600. */
@font-face {
	font-family: 'Geist';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('../fonts/geist.woff2') format('woff2');
}
@font-face {
	font-family: 'Geist Mono';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('../fonts/geist-mono.woff2') format('woff2');
}

/* ── Design tokens (docs/03) ─────────────────────────────────────────────
   --hue drives every persona-derived colour. It is 250 (blue) everywhere;
   on the home page assets/home.js re-sets it on <html> as the "Who it's for"
   persona changes, and because these tokens are declared on the same element
   they recompute, so the header button, the logo dot, the footer and every
   CTA follow the persona without any of them being touched. */
:root {
	--hue: 250;

	--bg: oklch(0.205 0.055 250);
	--bg-glow: radial-gradient(1500px 700px at 24% 25%, oklch(0.42 0.145 250), transparent 68%),
		radial-gradient(1200px 800px at 92% 72%, oklch(0.29 0.1 232), transparent 70%);
	--body-fallback: #0f1424;

	--accent: oklch(0.8 0.12 var(--hue));
	--accent-text: oklch(0.85 0.09 var(--hue));
	--on-accent: #0b0f1f;

	--text: #eef0f4;
	--text-86: rgba(238, 240, 244, 0.86);
	--text-84: rgba(238, 240, 244, 0.84);
	--text-82: rgba(238, 240, 244, 0.82);
	--text-80: rgba(238, 240, 244, 0.8);
	--text-78: rgba(238, 240, 244, 0.78);
	--text-74: rgba(238, 240, 244, 0.74);
	/* The floor. Nothing used as text goes below .72 — the contrast floor on
	   all four persona grounds (docs/06). */
	--text-72: rgba(238, 240, 244, 0.72);
	--placeholder: rgba(238, 240, 244, 0.45);

	--line: rgba(233, 233, 237, 0.1);
	--line-card: rgba(233, 233, 237, 0.14);
	--line-strong: rgba(233, 233, 237, 0.26);

	--surface: rgba(255, 255, 255, 0.04);
	--surface-2: rgba(255, 255, 255, 0.07);
	--surface-band: rgba(0, 0, 0, 0.18);
	--panel: rgba(10, 14, 24, 0.72);
	--header-bg: rgba(8, 10, 18, 0.55);
	--menu-bg: #0b1020;

	--success: #86e3bb;
	--error: oklch(0.82 0.11 25);
	--warn: oklch(0.86 0.1 75);
	--focus: #eef0f4;

	/* Persona-derived (docs/03 "Homepage persona themes"). */
	--p-accent: oklch(0.7 0.155 var(--hue));
	--p-soft: oklch(0.91 0.055 var(--hue));
	--p-hl: oklch(0.7 0.155 var(--hue) / 0.14);
	--p-line: oklch(0.7 0.155 var(--hue) / 0.45);
	--p-tab-bg: oklch(0.7 0.155 var(--hue) / 0.16);

	--font: 'Geist', ui-sans-serif, system-ui, sans-serif;
	--mono: 'Geist Mono', ui-monospace, monospace;

	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 14px;

	/* The content column is 1320px wide; a container adds its gutters OUTSIDE
	   that, as the handoff's content-box containers do. */
	--maxw: 1320px;
	--gutter: clamp(16px, 4vw, 40px);
	--container: calc(var(--maxw) + 2 * var(--gutter));

	/* Anchored headings land this far below the top of the viewport instead of
	   underneath the sticky header (docs/04 §1). */
	--header-offset: 96px;

	/* ── The previous design's tokens, as aliases ─────────────────────────
	   Kept so the pages not yet redesigned (guides, tools, legal, contact)
	   take the new palette through the names their own styles already use. */
	--color-bg: var(--bg);
	--color-surface: oklch(0.25 0.05 var(--hue));
	--color-text: var(--text);
	--color-text-quiet: var(--text-74);
	--color-accent: var(--accent);
	--color-accent-ink: var(--accent-text);
	--color-divider: var(--line);
	--color-section: oklch(0.3 0.09 var(--hue));
	--color-section-glow: oklch(0.38 0.11 var(--hue));
	--color-accent-100: oklch(0.96 0.02 var(--hue));
	--color-accent-200: oklch(0.91 0.055 var(--hue));
	--color-accent-300: oklch(0.86 0.09 var(--hue));
	--color-accent-400: oklch(0.8 0.12 var(--hue));
	--color-accent-500: oklch(0.72 0.14 var(--hue));
	--color-accent-600: oklch(0.6 0.13 var(--hue));
	--color-accent-700: oklch(0.48 0.11 var(--hue));
	--color-accent-800: oklch(0.36 0.09 var(--hue));
	--color-accent-900: oklch(0.27 0.07 var(--hue));
	--color-neutral-100: #f3f5fe;
	--color-neutral-200: #e4e7f5;
	--color-neutral-300: #cfd3e5;
	--color-neutral-400: #b2b6ca;
	--color-neutral-500: #9397ab;
	--color-neutral-600: rgba(233, 233, 237, 0.4);
	--color-neutral-700: rgba(233, 233, 237, 0.26);
	--color-neutral-800: rgba(233, 233, 237, 0.16);
	--color-neutral-900: rgba(233, 233, 237, 0.08);
	--shadow-sm: 0 0 0 1px var(--line-card);
	--shadow-md: 0 0 0 1px var(--line-strong), 0 6px 18px rgba(0, 0, 0, 0.55);
	--shadow-lg: 0 0 0 1px var(--line-strong), 0 16px 40px rgba(0, 0, 0, 0.65);
}

/* ── Page shell ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
	background: var(--body-fallback);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}
/* The navy ground and its glow, repeated every 2200px so a long page keeps
   its light all the way down. body is the positioned, isolated root: #gk-top
   and the home page's persona layers are placed against it, and the layers'
   z-index: -1 paints them over this ground but under every word. */
body {
	position: relative;
	isolation: isolate;
	margin: 0;
	min-height: 100vh;
	background-color: var(--bg);
	background-image: var(--bg-glow);
	background-size: 100% 2200px;
	background-repeat: repeat-y;
	color: var(--text);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.55;
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	overflow-x: hidden;
}
@media (prefers-reduced-motion: no-preference) {
	body { animation: gk-page 520ms ease both; }
}
@keyframes gk-page { from { opacity: 0; } to { opacity: 1; } }

h1, h2, h3, h4 {
	font-weight: 600;
	line-height: 1.12;
	letter-spacing: -0.02em;
	margin: 0;
}
p { margin: 0; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: #ffffff; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); }
/* The hidden attribute is only a UA `display: none`, and any class that sets
   display (.btn, .cta-row …) beats it. Pages switch states with `hidden`, so
   it has to win. */
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
/* Anything that can be a #fragment target stops below the sticky header
   rather than underneath it. scroll-margin rather than html's
   scroll-padding: the two ADD, and only one of them may be set. */
[id] { scroll-margin-top: var(--header-offset); }

.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.visually-hidden {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.wrap {
	position: relative; z-index: 1;
	max-width: var(--container);
	margin: 0 auto;
	padding-inline: var(--gutter);
}
section { position: relative; z-index: 1; }

/* ── Rules fade at their ends. ───────────────────────────────────────── */
.rule {
	height: 1px; border: 0; margin: 0;
	background: linear-gradient(to right, transparent, var(--line-card) 48px,
		var(--line-card) calc(100% - 48px), transparent);
}

/* Eyebrow: Geist Mono, uppercase, accent. */
.kicker {
	font-family: var(--mono);
	font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase;
	color: var(--accent-text); margin: 0;
}
.kicker-quiet { color: var(--text-74); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px;
	cursor: pointer; text-decoration: none;
	font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.2;
	color: var(--text);
	background: transparent; border: 1px solid transparent;
	padding: 11px 18px; border-radius: var(--radius-md);
	transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease, filter 200ms ease;
}
.btn-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.08); }
.btn-secondary { font-weight: 500; border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: rgba(233, 233, 237, 0.4); }
.btn-lg { min-height: 48px; padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn svg { display: block; flex: none; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.6; cursor: progress; }

.card {
	background: var(--surface);
	border: 1px solid var(--line-card);
	border-radius: var(--radius-lg);
}

/* ── Form fields ───────────────────────────────────────────────────────── */
.input {
	flex: 1; min-width: 0; min-height: 48px; padding: 0 14px;
	font: inherit; font-size: 15px; color: var(--text);
	caret-color: var(--accent);
	background: rgba(0, 0, 0, 0.25);
	border: 1px solid var(--line-strong); border-radius: var(--radius-md);
}
.input::placeholder { color: var(--placeholder); opacity: 1; }
.input:hover { border-color: rgba(233, 233, 237, 0.4); }
.input:focus-visible { border-color: var(--accent); }
.input[aria-invalid='true'] { border-color: var(--error); }
/* Chromium paints its own autofill background through an internal UA layer
   that a plain `background` cannot reach — an inset box-shadow the size of
   the field is the only override surface it exposes. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
	-webkit-box-shadow: 0 0 0 1000px #0c1322 inset;
	box-shadow: 0 0 0 1000px #0c1322 inset;
	-webkit-text-fill-color: var(--text);
	caret-color: var(--accent);
}

/* ── Skip link ─────────────────────────────────────────────────────────
   First focusable thing on every page; invisible until focused. Clipped
   away rather than pushed off-screen: the header is sticky, so an offset
   only hides the link while the header sits at the top of the page. */
.skip-link {
	position: absolute; left: 12px; top: 12px; z-index: 40;
	padding: 10px 14px; border-radius: var(--radius-md);
	background: var(--text); color: var(--on-accent);
	font-weight: 600; text-decoration: none; font-size: 15px;
}
.skip-link:hover { color: var(--on-accent); }
.skip-link:not(:focus):not(:focus-visible) {
	width: 1px; height: 1px; padding: 0; overflow: hidden;
	clip-path: inset(50%); white-space: nowrap;
}

/* ── #gk-top: what "Back to top" scrolls to ────────────────────────────── */
.gk-top-anchor {
	position: absolute; top: 0; left: 0; width: 1px; height: 1px;
	pointer-events: none; scroll-margin-top: 0;
}

/* ── Shared header (docs/04 §2) ────────────────────────────────────────
   One row at every width. The bar is always on its blurred ground; once the
   page has scrolled, site.js sets data-scrolled and it gains a soft edge. */
.gk-header {
	position: sticky; top: 0; z-index: 20;
	background: var(--header-bg);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	backdrop-filter: blur(14px) saturate(140%);
	border-bottom: 1px solid var(--line);
	transition: box-shadow 200ms ease;
}
.gk-header[data-scrolled] { box-shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.7); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.gk-header { background: rgba(8, 10, 18, 0.94); }
}
.gk-nav {
	max-width: var(--container); margin: 0 auto;
	padding: 18px var(--gutter);
	display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between;
	gap: 16px 32px;
}
.gk-logo {
	display: inline-flex; align-items: center; gap: 10px; flex: none;
	color: var(--text); text-decoration: none;
	font-weight: 600; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
}
.gk-logo:hover { color: var(--text); }
.gk-dot {
	width: 7px; height: 7px; flex: none; border-radius: 1px;
	background: var(--accent); color: var(--accent);
	animation: gk-pulse 2.6s ease-out infinite;
}
@keyframes gk-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
	70%  { box-shadow: 0 0 0 9px transparent; }
	100% { box-shadow: 0 0 0 0 transparent; }
}
.gk-links { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 15px; }
.gk-links a { color: var(--text-84); text-decoration: none; }
.gk-links a:hover { color: #ffffff; }
.gk-links a[aria-current='page'],
.gk-menu-panel a[aria-current='page'] { color: #ffffff; }
.gk-links a[aria-current='page'] {
	text-decoration: underline; text-decoration-color: var(--accent);
	text-decoration-thickness: 2px; text-underline-offset: 8px;
}
.gk-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.gk-signin {
	display: inline-flex; align-items: center; min-height: 44px; padding: 10px 12px;
	color: var(--text); text-decoration: none; font-size: 15px;
}
.gk-cta {
	display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px;
	border-radius: var(--radius-md);
	background: var(--accent); color: var(--on-accent);
	font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.gk-cta:hover { color: var(--on-accent); filter: brightness(1.08); }

/* The phone menu: a native <details>, so it opens and closes with or without
   script. site.js adds the closing rules — a link tap, Escape (focus back to
   the button) and a pointer-down outside. */
.gk-menu { display: none; }
.gk-menu > summary { list-style: none; }
.gk-menu > summary::-webkit-details-marker { display: none; }
.gk-menu-button {
	cursor: pointer; width: 44px; height: 44px; border-radius: var(--radius-md);
	border: 1px solid rgba(233, 233, 237, 0.24);
	display: grid; place-items: center; color: var(--text);
}
.gk-menu[open] .gk-menu-button { background: var(--surface-2); }
.gk-menu-panel {
	position: absolute; left: 0; right: 0; top: 100%;
	background: var(--menu-bg);
	border-top: 1px solid var(--line); border-bottom: 1px solid rgba(233, 233, 237, 0.16);
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
	padding: 6px var(--gutter) 14px;
}
.gk-menu-panel a {
	display: flex; align-items: center; min-height: 48px;
	border-bottom: 1px solid rgba(233, 233, 237, 0.08);
	font-size: 17px; text-decoration: none; color: var(--text-84);
}
.gk-menu-panel a[aria-current='page'] { font-weight: 600; }
.gk-menu-panel li:last-child a { border-bottom: 0; color: var(--text); }

@media (max-width: 940px) {
	.gk-links { display: none; }
	.gk-menu { display: block; }
}
@media (max-width: 560px) {
	:root { --header-offset: 80px; }
	.gk-nav { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
	.gk-logo { font-size: 14px; letter-spacing: 0.06em; }
	.gk-signin { display: none; }
	.gk-actions { gap: 10px; }
	.gk-cta { padding: 9px 12px; font-size: 14px; }
}
@media (max-width: 340px) {
	.gk-nav { gap: 8px; }
	.gk-actions { gap: 8px; }
	.gk-logo { letter-spacing: 0.04em; gap: 8px; }
	.gk-cta { padding: 9px 10px; }
}

/* ── Shared footer (docs/04 §3) ──────────────────────────────────────── */
.gk-footer { border-top: 1px solid var(--line); line-height: 1.55; }
.gk-footer-inner {
	max-width: var(--container); margin: 0 auto;
	padding: 56px var(--gutter) 64px;
	display: flex; flex-direction: column; gap: 28px;
}
.gk-footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px 48px; }
.gk-footer-brand { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.gk-footer-brand p { font-size: 15px; color: var(--text-78); }
.gk-footer-brand .gk-footer-selfhost { font-size: 14px; color: var(--text-74); }
.gk-footer-brand .gk-footer-selfhost a { color: var(--text-84); }
.gk-footer-cols {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 24px 40px; flex: 0 1 620px; min-width: 0;
}
.gk-footer-col ul { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.gk-footer-label {
	font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
	color: var(--text-72); margin-bottom: 10px;
}
.gk-footer-col a { color: var(--text-84); text-decoration: none; }
.gk-footer-col a:hover { color: #ffffff; text-decoration: underline; }
.gk-footer-fine {
	border-top: 1px solid var(--line); padding-top: 24px;
	display: flex; flex-direction: column; gap: 10px;
	font-size: 13px; line-height: 1.6; color: var(--text-74);
}

/* Back to top: a link to #gk-top, so it works without script — but it only
   appears with script, which decides when (docs/04 §3): past 600px on wide
   screens; on phones only while scrolling up or near the end of the page.
   Hidden means hidden to everyone: visibility, aria-hidden and tabindex
   move together in site.js. */
.gk-to-top {
	position: fixed; z-index: 30;
	right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
	width: 48px; height: 48px; border-radius: 999px;
	display: none; place-items: center;
	color: var(--accent); text-decoration: none;
	background: rgba(10, 14, 24, 0.84); border: 1px solid rgba(233, 233, 237, 0.22);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
	-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
	opacity: 0; transform: translateY(10px); visibility: hidden; pointer-events: none;
	transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms;
}
.gk-js .gk-to-top { display: grid; }
.gk-to-top[data-shown] {
	opacity: 1; transform: none; visibility: visible; pointer-events: auto;
	transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 0s;
}
.gk-to-top:hover { color: var(--accent); }

/* ── Wide screens ──────────────────────────────────────────────────────
   Every size here is in px, so on a big monitor the column would fill a
   third of the screen at laptop type sizes. zoom scales type, spacing and
   the column together (docs/03 "Wide screens"). Media queries are evaluated
   against the unzoomed viewport, so the steps do not feed back. */
@media (min-width: 1680px) { body { zoom: 1.1; } }
@media (min-width: 1920px) { body { zoom: 1.2; } }
@media (min-width: 2400px) { body { zoom: 1.4; } }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.gk-dot { animation: none; }
	.gk-header, .btn, .gk-to-top, .gk-to-top[data-shown] { transition: none; }
}
