/* Base: reset, type, form elements and the page shell (top navigation,
   content column, footer). Tokens in tokens.css; components in
   components.css (internal/web/UI.md). No inline styles anywhere: the CSP
   is style-src 'self'. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a { color: var(--accentText); text-decoration: none; text-underline-offset: 2px; }
a:hover { color: var(--text); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { margin: 0; color: var(--text); }
h1, h2 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: 36px; line-height: 1.15; letter-spacing: -.015em; }
h2 { font-size: 23px; line-height: 1.25; }
h3 { font-size: 16.5px; font-weight: 600; line-height: 1.35; }
p { margin: 0 0 .75rem; }
strong, b { font-weight: 600; }

code, kbd, samp, pre { font-family: var(--mono); }
code {
	font-size: 13.5px;
	background: var(--codeBg);
	color: var(--text);
	padding: 1px 6px;
	border-radius: var(--r-sm);
	overflow-wrap: anywhere;
}
pre {
	margin: 0;
	padding: 12px 14px;
	background: var(--codeBg);
	border-radius: var(--r-ctl);
	font-size: 13.5px;
	line-height: 1.55;
	overflow: auto;
	tab-size: 4;
}
pre code { background: none; padding: 0; font-size: inherit; }

time, .num { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

img, svg { vertical-align: middle; }
svg.icon { flex: none; }

/* Form elements: B1's fields (44px, 12px radius). Wrappers and labels are
   components (.field, .select, .check, .option). The selectors weigh no
   more than an element (:where), so any class wins. */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input:where(:not([type=checkbox], [type=radio], [type=hidden], [type=submit], [type=range])),
select, textarea {
	width: 100%;
	min-height: 44px;
	padding: 0 14px;
	background: var(--field);
	border: 1px solid var(--fieldLine);
	border-radius: var(--r-ctl);
	font-size: 16px;
	color: var(--text);
}
textarea { padding: 12px 14px; line-height: 1.6; resize: vertical; min-height: 6rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:where(input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accentLine); }
:where(input, select, textarea):disabled {
	background: transparent; border-style: dashed; border-color: var(--chipLine); color: var(--muted); cursor: not-allowed;
}
input:where([type=checkbox], [type=radio]) { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
/* Code-like values: tokens, cron, paths. */
.mono, input.mono, textarea.mono { font-family: var(--mono); font-size: 15px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

/* Utilities */
.muted { color: var(--muted); }
.text2 { color: var(--text2); }
.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }

.skip {
	position: absolute; left: 1rem; top: .5rem; z-index: 20;
	background: var(--card); color: var(--text); padding: .5rem .75rem; border-radius: var(--r-sm);
	box-shadow: var(--popShadow);
}
.skip:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); box-shadow: none; }

/* The development login (DEV_LOGIN): above the navigation on every page. */
.devlogin {
	margin: 0; padding: 9px 16px; text-align: center; font-size: 15px;
	background: var(--badBg); color: var(--bad); border-bottom: 2px solid var(--bad);
}
.devlogin strong { font-weight: 700; }

/* Top navigation */
.topnav { background: var(--nav); border-bottom: 1px solid var(--navLine); }
.topnav-inner {
	max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter);
	display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 18.5px; letter-spacing: -.01em; white-space: nowrap; }
.logo { width: 26px; height: 26px; flex: none; }
.logo .logo-bg { fill: var(--logoBg); }
.logo .logo-fg { fill: var(--logoFg); }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; flex: 1 1 auto; }
.nav a, .navmenu-panel a {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 7px 14px; border-radius: var(--r-pill);
	color: var(--text2); font-weight: 500; font-size: 15px; text-decoration: none;
}
.nav a:hover, .navmenu-panel a:hover { color: var(--text); background: var(--neutralBg); text-decoration: none; }
.nav a[aria-current="page"], .navmenu-panel a[aria-current="page"] { background: var(--accentBg); color: var(--accentText); font-weight: 600; }
/* The unread count of the inbox */
.count {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
	background: var(--accent); color: var(--onAccent); font-size: 12.5px; font-weight: 700; line-height: 20px;
	display: inline-flex; align-items: center; justify-content: center;
}

/* Menus: <details class="menu"> with a <summary> and a .menu-panel. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
	position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 16rem;
	background: var(--card); border: var(--cardBorder); border-radius: 14px; box-shadow: var(--popShadow);
	padding: 14px 16px; font-size: 15px;
}
.menu-panel p { color: var(--muted); margin: 0 0 12px; overflow-wrap: anywhere; }
.menu-panel p strong { color: var(--text); }
.menu-panel form { margin: 0; }
.menu-panel .menu-label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.usermenu .menu-panel { min-width: 19rem; }
.menu-panel .seg { display: flex; flex-wrap: nowrap; }
.menu-panel .seg > * { flex: 1; min-height: 38px; padding: 6px 10px; }
.menu-who strong { display: block; color: var(--text); font-size: 16.5px; line-height: 1.35; overflow-wrap: anywhere; }
.menu-who .menu-email { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.menu-panel .menu-sec + .menu-sec { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

.usermenu > summary {
	display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--r-pill);
	color: var(--text); font-weight: 500; font-size: 15px;
}
.usermenu > summary .icon { color: var(--muted); }
.avatar {
	width: 32px; height: 32px; border-radius: 50%; flex: none;
	background: var(--avatarBg); color: var(--avatarFg); font-weight: 700; font-size: 13.5px;
	display: inline-flex; align-items: center; justify-content: center;
}

/* The navigation's menu on narrow screens (the same items as .nav). */
.navmenu { display: none; }
.navmenu > summary {
	position: relative; width: 44px; height: 44px; border-radius: var(--r-ctl);
	display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.navmenu > summary .count { position: absolute; top: 2px; right: -2px; min-width: 18px; height: 18px; font-size: 11.5px; padding: 0 5px; }
.navmenu .menu-panel { left: 0; right: auto; padding: 8px; min-width: 14rem; }
.navmenu-panel { display: flex; flex-direction: column; gap: 2px; }
.navmenu-panel a { border-radius: 10px; min-height: 44px; padding: 0 14px; }

/* Content column and footer */
.page { flex: 1 0 auto; width: 100%; max-width: var(--content); margin: 0 auto; padding: 40px var(--gutter) 56px; }
.page.wide { max-width: 1440px; }
.page.narrow { max-width: 720px; }
.foot { border-top: 1px solid var(--navLine); }
.foot-inner {
	max-width: var(--content); margin: 0 auto; padding: 20px var(--gutter);
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
	font-size: 14px; color: var(--muted);
}
.foot .version { font-family: var(--mono); font-size: 13px; }

@media (max-width: 900px) {
	.nav { display: none; }
	.navmenu { display: block; order: -1; margin-left: -10px; }
	.topnav-inner { gap: 8px 12px; }
	.brand { margin-right: auto; }
	.usermenu-name { display: none; }
}
@media (max-width: 640px) {
	:root { --gutter: 16px; }
	h1 { font-size: 28px; }
	.page { padding-top: 24px; padding-bottom: 40px; }
	.topnav-inner { min-height: 56px; }
	.brand-name { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
