/* Global styles, design tokens and the pieces used on many pages.
   Each page adds its own stylesheet (css/<page>.css) for its layout. */

:root {
	/* Status colors */
	--c-ok: #2b8a3e; /* signed off / success */
	--c-pending: #6741d9; /* child marked done, waiting for a parent */
	--c-danger: #c62828; /* errors, delete, late */
	--c-primary: #1565c0;
	--c-ok-bg: #2b8a3e22;
	--c-pending-bg: #6741d922;

	/* Translucent greys that read well in both light and dark mode */
	--border: #8886;
	--border-soft: #8884;
	--border-strong: #8889;
}

body {
	font-family: system-ui, sans-serif;
}

/* Instant taps on touch screens, no grey flash */
button,
a {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

/* Visually hidden, still read by screen readers */
.sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Lets a <form> wrap controls without breaking its parent's grid */
.contents {
	display: contents;
}

/* The page's error line (#page-error). Components such as inputs, buttons and notices are in css/ui.css. */
.error {
	color: var(--c-danger);
}

.error:empty {
	display: none;
}

/* ---- Header bar with the breadcrumb (Views/Shared/_Layout.cshtml, Infrastructure/AppHeader.cs) ---- */

.app-header {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.75rem 1rem;
	background: var(--user-color, var(--c-primary));
	color: white;
}

.crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.crumbs li {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.crumbs li + li::before {
	content: "›";
	font-size: 1.4rem;
	line-height: 1;
	opacity: 0.75;
}

/* Earlier segments are buttons back up the trail; the last one is where you are. */
.crumbs a,
.crumbs [aria-current] {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.8rem;
	padding: 0.25rem 0.9rem;
	border-radius: 0.75rem;
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

.crumbs a {
	background: #fff3;
}

.crumbs a:active {
	background: #fff5;
}

.crumbs a:focus-visible {
	outline: 3px solid white;
	outline-offset: 2px;
}

.crumbs [aria-current] {
	font-size: 1.15rem;
}

/* A person's avatar in front of their name. */
.crumbs img {
	width: 2.3rem;
	height: 2.3rem;
	margin-left: -0.5rem;
}

@media print {
	.app-header {
		display: none;
	}
}

/* ---- Tasks content column (Areas/Tasks/Views/Shared/_TasksLayout.cshtml) ---- */

/* Centre the content on wide screens; each page may narrow itself further. */
.shell-main {
	max-width: 56rem;
	margin: 0 auto;
	padding: 1.5rem 1rem;
}

.shell-main > * {
	margin-inline: auto;
}

/* Text every Tasks page uses: the page heading, a quieter line under it, "nothing here yet",
   and points still waiting for a parent's sign-off. */
.shell-main h1 {
	margin: 0 0 0.5rem;
	font-size: 1.4rem;
}

.shell-main .lead {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	opacity: 0.75;
}

.shell-main .empty {
	opacity: 0.75;
}

.shell-main .wait {
	font-size: 0.9rem;
	color: var(--c-pending);
}

/* ---- Child chips (Views/Shared/_ChildChips.cshtml) ---- */

.chips {
	display: flex;
	gap: 0.4rem;
	margin: 0.5rem 0;
}

/* Phone: always two across (2x2 for four children). Wider: back to one row. */
.chips.wrap {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 40rem) {
	.chips.wrap {
		grid-auto-flow: column;
		grid-auto-columns: 1fr;
		grid-template-columns: none;
	}
}

.chip {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	box-sizing: border-box;
	height: 2.8rem;
	padding: 0;
	font: inherit;
	font-weight: 600;
	border: 2px solid var(--chip-color);
	border-radius: 0.8rem;
	background: Canvas;
	color: CanvasText;
	text-decoration: none;
	cursor: pointer;
}

.chip.active {
	background: var(--chip-color);
	color: white;
}

.chip:focus-visible {
	outline: 3px solid #000a;
	outline-offset: 2px;
}

.chip .badge {
	min-width: 1.4rem;
	padding: 0 0.4rem;
	border-radius: 999px;
	background: #8883;
	font-size: 0.85rem;
	line-height: 1.4rem;
	text-align: center;
}

.chip.active .badge {
	background: #fff3;
}

/* While htmx waits for the server, dim what is being updated a little. */
.htmx-request {
	opacity: 0.7;
	transition: opacity 0.2s;
}
