/* Styles shared by every page. All values come from tokens.css. */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

/* Anything marked hidden stays hidden, whatever layout its other styles give it. Without this, an element styled as a grid or flex box would ignore the hidden attribute. */
[hidden] {
	display: none !important;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--color-pavement);
	color: var(--color-ink);
	font-family: var(--font-family);
	font-size: var(--font-size-body);
	line-height: var(--line-height-body);
}

h1,
h2,
h3 {
	margin: 0;
	line-height: var(--line-height-tight);
	font-weight: 800;
}

p {
	margin: 0;
}

a {
	color: inherit;
}

:focus-visible {
	outline: 3px solid var(--color-focus);
	outline-offset: 2px;
}

/* The bar across the top of every page: a navy sign plate carrying the product name. */
.site-header {
	position: relative;
	z-index: 10;
	display: flex;
	flex: none;
	align-items: center;
	gap: var(--space-5);
	height: var(--header-height);
	padding: 0 var(--space-5);
	background: var(--color-ink);
	color: var(--color-surface);
}

/* The name stays on one line. If the header ever runs out of room, the name is cut short before the links are. */
.site-name {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	padding-top: 2px;
	font-size: var(--font-size-lead);
	font-weight: 800;
	letter-spacing: -0.01em;
	text-decoration: none;
	white-space: nowrap;
}

.site-name-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The mark beside the name: the "you are here" dot of a street map, in the yellow that stands for the person themselves. */
.site-mark {
	flex: none;
	width: 14px;
	height: 14px;
	margin: 0 3px 2px;
	border-radius: var(--radius-round);
	background: var(--color-signal);
	box-shadow: 0 0 0 3px rgb(255 196 0 / 0.28);
}

/* A short message standing alone on a page, such as "page not found". */
.notice {
	max-width: 36rem;
	margin: 0 auto;
	padding: var(--space-8) var(--space-4);
}

.notice h1 {
	font-size: var(--font-size-display);
}

.notice p {
	margin-top: var(--space-4);
	color: var(--color-ink-soft);
	font-size: var(--font-size-lead);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* On the navy of the header the usual blue focus ring would barely show, so it is yellow there. */
.site-header :focus-visible {
	outline-color: var(--color-signal);
}

/* The links in the header. The places a person goes sit beside the name; their own account sits at the far end. */
.account-links {
	display: flex;
	flex: 1;
	align-items: stretch;
	align-self: stretch;
	min-width: 0;
	font-weight: 600;
}

.account-links > a,
.account-links > .link-button {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 7px;
	padding: 2px 14px 0;
	color: rgb(255 255 255 / 0.76);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: color var(--duration-quick);
}

.account-links > a:hover,
.account-links > .link-button:hover,
.account-links > [aria-current="page"] {
	color: var(--color-surface);
	text-decoration: none;
}

/* The page being looked at is underlined in yellow, as the line a traveller is on is picked out on a sign. site.js marks it. */
.account-links > [aria-current="page"]::after {
	content: "";
	position: absolute;
	right: 14px;
	bottom: 0;
	left: 14px;
	height: 4px;
	border-radius: 4px 4px 0 0;
	background: var(--color-signal);
}

/* Everything from here on belongs to the person's own account, and is pushed to the far end. For a visitor that is every link. */
.account-links > .account-settings {
	margin-left: auto;
}

.account-links.is-visitor {
	justify-content: flex-end;
}

.account-links > .account-name {
	color: var(--color-surface);
	gap: 9px;
}

.account-name-text {
	max-width: 12ch;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The person's initial, on the yellow of their own marker. */
.account-initial {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 28px;
	height: 28px;
	margin-top: -2px;
	padding-top: 2px;
	border-radius: var(--radius-round);
	background: var(--color-signal);
	color: var(--color-ink);
	font-size: var(--font-size-small);
	font-weight: 800;
	line-height: 1;
}

/* A button that reads as a link, for actions that sit among links. */
.link-button {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* The header's one prominent link, drawn as a small yellow sign plate. */
.account-links > .plate-link {
	align-self: center;
	height: 40px;
	margin-left: var(--space-2);
	padding: 2px var(--space-4) 0;
	border-radius: var(--radius-plate);
	background: var(--color-signal);
	color: var(--color-ink);
	font-weight: 700;
	transition: background-color var(--duration-quick);
}

.account-links > .plate-link:hover {
	background: var(--color-signal-pressed);
	color: var(--color-ink);
}

/* A one-off message across the top of a page, such as "Log in to see that page." */
.notice-bar {
	padding: var(--space-3) var(--space-4);
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-line);
	font-weight: 600;
	text-align: center;
}

/* Buttons. Every button gives way visibly when pressed, and shows a spinner while its action is in progress. The typeface sits high on its line, so the words are nudged down to the middle. */
.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-height: 44px;
	padding: 2px 18px 0;
	border: 1.5px solid var(--color-ink);
	border-radius: var(--radius-plate);
	background: var(--color-surface);
	color: var(--color-ink);
	font: inherit;
	font-size: var(--font-size-body);
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: transform var(--duration-quick), background-color var(--duration-quick), border-color var(--duration-quick);
}

.button:hover {
	background: var(--color-pavement);
}

.button:active {
	transform: translateY(1px);
}

.button-signal {
	border-color: var(--color-signal);
	background: var(--color-signal);
}

.button-signal:hover,
.button-signal:active {
	border-color: var(--color-signal-pressed);
	background: var(--color-signal-pressed);
}

/* The one button a whole page leads to. */
.button-large {
	min-height: 54px;
	padding-right: 26px;
	padding-left: 26px;
	font-size: var(--font-size-lead);
}

/* A button on navy that is not the main one: an outline, so that the yellow beside it stays the only filled thing. */
.button-ghost {
	border-color: rgb(255 255 255 / 0.5);
	background: transparent;
	color: var(--color-surface);
}

.button-ghost:hover {
	border-color: var(--color-surface);
	background: rgb(255 255 255 / 0.12);
}

/* A smaller button, for a row of several. */
.button-small {
	min-height: 38px;
	padding: 1px var(--space-3) 0;
	font-size: 0.875rem;
}

.button:disabled,
.link-button:disabled {
	cursor: progress;
	opacity: 0.75;
}

.is-busy::before {
	content: "";
	width: 1em;
	height: 1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: var(--radius-round);
	animation: spin 0.7s linear infinite;
}

.link-button.is-busy {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Brief messages that appear near the top of the screen, clear of the controls at the bottom, and remove themselves. */
.toasts {
	position: fixed;
	left: 50%;
	top: calc(var(--header-height) + var(--space-3));
	z-index: 20;
	display: grid;
	gap: var(--space-2);
	width: min(92vw, 28rem);
	transform: translateX(-50%);
	pointer-events: none;
}

.toast {
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-plate);
	background: var(--color-ink);
	color: var(--color-surface);
	font-weight: 600;
	box-shadow: var(--shadow-float);
}

.toast-problem {
	background: var(--color-danger);
}

/* Each intent's colour, made available to anything drawn for that intent. The class is "intent-" followed by the intent's stored name. */
.intent-known {
	--intent-color: var(--color-intent-known);
}

.intent-new_friends {
	--intent-color: var(--color-intent-new-friends);
}

.intent-dating {
	--intent-color: var(--color-intent-dating);
}

.intent-activity {
	--intent-color: var(--color-intent-activity);
}

.intent-business {
	--intent-color: var(--color-intent-business);
}

/* The round sign carrying an intent's letter. The letter is what tells intents apart for someone who cannot tell the colours apart. */
.roundel {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding-top: 1px;
	border-radius: var(--radius-round);
	background: var(--intent-color);
	color: var(--color-surface);
	font-size: var(--font-size-small);
	font-weight: 800;
	line-height: 1;
}

/* A proper name that could be read as an ordinary word. It is coloured and heavier, so the difference does not rest on colour alone. */
.proper-name {
	color: var(--color-proper-name);
	font-weight: 800;
}

/* Text that is there for screen readers only. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* A count beside a link or a row, such as the number of unread messages. */
.badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 1px 5px 0;
	border-radius: var(--radius-round);
	background: var(--color-signal);
	color: var(--color-ink);
	font-size: 0.6875rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* Small labels beside a name: quiet outlines, so that a row of them does not outweigh the name. */
.tag {
	display: inline-flex;
	flex: none;
	align-items: center;
	height: 18px;
	padding: 1px 6px 0;
	border: 1px solid var(--color-line);
	border-radius: 4px;
	background: var(--color-surface);
	color: var(--color-ink-soft);
	font-size: 0.6875rem;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
}

.tag-friend {
	border-color: var(--color-intent-known);
	color: #14744f;
}

/* Marks the person's own name. Signal yellow is used for nothing but the person themselves. */
.tag-you {
	border-color: var(--color-signal);
	background: var(--color-signal);
	color: var(--color-ink);
}

/* The round picture that stands for a person. Until they have a photo it carries their initial, on the colour of an intent where one applies. */
.avatar {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--radius-round);
	background: var(--intent-color, var(--color-ink));
	color: var(--color-surface);
	font-size: var(--font-size-lead);
	font-weight: 800;
}

/* A picture fills the circle. The colour behind it shows only while it loads. */
.avatar.has-picture {
	overflow: hidden;
	background: var(--color-line);
}

.avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The person's own picture, in the colour of their own marker on the map. */
.avatar-self {
	border: 4px solid var(--color-ink);
	background: var(--color-signal);
	color: var(--color-ink);
}

/* With a picture of their own, the yellow moves to a ring around it. */
.avatar-self.has-picture {
	border-color: var(--color-signal);
}

/* The control for a person's own profile picture: the picture, the buttons that change it, and what to expect. */
.picture-control {
	display: flex;
	align-items: center;
	gap: var(--space-4);
}

.picture-preview {
	width: 88px;
	height: 88px;
	font-size: var(--font-size-heading);
}

.picture-side {
	display: grid;
	gap: var(--space-2);
	min-width: 0;
}

.picture-side .field-hint,
.picture-side .field-error {
	margin: 0;
}

/* A small window with a short message and one button, such as the one behind the mobile app links. */
.small-dialog {
	width: min(92vw, 26rem);
	padding: var(--space-5);
	border: 0;
	border-radius: var(--radius-plate);
	background: var(--color-surface);
	color: var(--color-ink);
	box-shadow: var(--shadow-float);
}

.small-dialog::backdrop {
	background: rgb(20 33 61 / 0.55);
}

.small-dialog h2 {
	font-size: var(--font-size-title);
}

.small-dialog p {
	margin-top: var(--space-3);
	font-size: var(--font-size-lead);
}

.small-dialog form {
	margin-top: var(--space-5);
}

/* Mute, block and report: a quiet row beneath the main actions, wherever one person looks at another. */
.safety {
	margin-top: var(--space-4);
	padding-top: var(--space-3);
	border-top: 1px solid var(--color-line);
}

.safety-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-5);
}

.safety-button {
	min-height: 32px;
	color: var(--color-ink-soft);
	font-size: var(--font-size-small);
	text-decoration: underline;
}

.safety-button:hover {
	color: var(--color-ink);
}

.safety-confirm {
	display: grid;
	gap: var(--space-3);
	font-size: var(--font-size-body);
}

.safety-confirm .button-row,
.report-dialog .button-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

/* The window for making a report. */
.report-dialog .form {
	display: grid;
	gap: var(--space-4);
	margin-top: var(--space-4);
}

.report-dialog .field-hint,
.report-dialog .field-error {
	margin-top: var(--space-2);
	font-size: var(--font-size-small);
}

.report-dialog .button-row {
	margin-top: var(--space-4);
}

.tag-muted {
	border: 1px solid var(--color-line);
	color: var(--color-ink-soft);
}

/* "Me" stands in for the person's name where there is no room for it. */
.account-links > .account-me {
	display: none;
}

/* On a narrow screen the header has room for the main links but not for the person's name, "Settings" or "Log out" as well. "Me" leads to the person's own profile, which links to settings, and logging out is on the settings page. */
@media (max-width: 699px) {
	.account-links > .account-name,
	.account-links > .account-settings,
	.account-links > .account-log-out {
		display: none;
	}

	.account-links > .account-me {
		display: inline-flex;
		margin-left: auto;
	}
}

/* On a phone the header's edges come in, and for someone who is logged in the name gives way to its mark alone, so that the links all fit on one line. A visitor still sees the name: it is what they came to read. */
@media (max-width: 519px) {
	.site-header {
		gap: var(--space-2);
		padding: 0 var(--space-3);
	}

	.site-header.is-member .site-name-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.account-links > a,
	.account-links > .link-button {
		padding-right: 10px;
		padding-left: 10px;
	}

	.account-links > [aria-current="page"]::after {
		right: 10px;
		left: 10px;
	}

	.account-links > .plate-link {
		height: 36px;
		padding-right: var(--space-3);
		padding-left: var(--space-3);
	}
}
