/*
 * Solrise customer portal.
 *
 * Loaded on every website page via `hooks.web_include_css`, but every rule is
 * namespaced `.sl-`, so it can only affect the portal pages.
 *
 * The brief is unusual and drives every decision here: the reader may not read
 * comfortably, and may be standing at a pump holding a phone in one hand in
 * daylight. Therefore - large type, large targets, few words, one obvious
 * action per screen, and no reliance on colour alone to carry meaning.
 *
 * Brand colours live in the four variables below; nothing else hard-codes one.
 * Changes here are picked up on the next page load - no build step, because
 * `www/` files are served as-is rather than through the site's asset pipeline.
 */

.sl-portal {
	--sl-ink: #14213d;
	--sl-muted: #5b6478;
	--sl-accent: #1f6feb;
	--sl-accent-ink: #ffffff;
	--sl-line: #d8dee9;
	--sl-surface: #ffffff;
	--sl-canvas: #f4f6fa;
	--sl-good: #157f3d;
	--sl-warn: #b3261e;

	/* The four "where is my report?" tones, and their tints. Colour is never the
	   only signal - every state also carries an icon and a word - so these
	   reinforce the answer rather than carry it. */
	--sl-tone-calm: #1f6feb;
	--sl-tone-calm-bg: #e8f0fe;
	--sl-tone-busy: #b45309;
	--sl-tone-busy-bg: #fdf1e3;
	--sl-tone-held: #5b6478;
	--sl-tone-held-bg: #eceff4;
	--sl-tone-good: #157f3d;
	--sl-tone-good-bg: #e6f4ec;

	max-width: 40rem;
	margin: 0 auto;
	padding: 1.25rem 1rem 4rem;
	color: var(--sl-ink);
	background: var(--sl-canvas);
	font-size: 1.0625rem;
	line-height: 1.4;
	/* No 300 ms double-tap delay on the buttons. */
	touch-action: manipulation;
}

/* Frappe's web template puts the page inside a container; these pages opt out
   of that box so the background reaches the edges on a phone. */
.sl-portal a {
	text-decoration: none;
}

/* --------------------------------------------------------------- page header */

.sl-head {
	text-align: center;
	padding: 1rem 0 1.5rem;
}

.sl-head__logo {
	max-width: 11rem;
	height: auto;
	margin-bottom: 0.75rem;
}

.sl-head__hello {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0;
}

.sl-head__station {
	color: var(--sl-muted);
	margin: 0.25rem 0 0;
	font-size: 1.0625rem;
}

/* -------------------------------------------------------------- button grid */

.sl-tiles {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

@media (min-width: 32rem) {
	.sl-tiles {
		grid-template-columns: 1fr 1fr;
	}
}

.sl-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 11rem;
	padding: 1.5rem 1rem;
	background: var(--sl-surface);
	border: 2px solid var(--sl-line);
	border-radius: 1rem;
	box-shadow: 0 1px 2px rgba(20, 33, 61, 0.06);
	color: var(--sl-ink);
	text-align: center;
	transition: border-color 120ms ease, transform 120ms ease;
}

.sl-tile:hover,
.sl-tile:focus {
	border-color: var(--sl-accent);
	transform: translateY(-2px);
}

.sl-tile:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 3px;
}

.sl-tile__icon {
	font-size: 3.5rem;
	line-height: 1;
}

.sl-tile__label {
	font-size: 1.5rem;
	font-weight: 700;
}

.sl-tile__caption {
	font-size: 1rem;
	color: var(--sl-muted);
}

/* ----------------------------------------------------------------- the form */

.sl-portal--form {
	max-width: 36rem;
}

.sl-back {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 3rem;
	padding: 0.25rem 0.75rem 0.25rem 0;
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--sl-ink);
}

.sl-back__icon {
	font-size: 1.5rem;
}

.sl-form__title {
	font-size: 1.625rem;
	font-weight: 700;
	margin: 0.5rem 0 0.75rem;
}

.sl-form__title--small {
	font-size: 1.25rem;
	margin-top: 2rem;
}

.sl-choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
}

.sl-choices--two {
	grid-template-columns: 1fr 1fr;
}

/* The maintenance category list is 22 entries, so its grid is deliberately more
   compact than the two-option urgency row: shorter tiles, a slightly smaller
   icon, and a third column once there is room. At 2 columns the whole form is
   still about two phone screens, which is the honest cost of 22 choices. */
.sl-choices--many .sl-choice {
	min-height: 5.5rem;
	padding: 0.5rem 0.375rem;
}

.sl-choices--many .sl-choice__icon {
	font-size: 1.9rem;
}

.sl-choices--many .sl-choice__label {
	font-size: 0.9375rem;
	line-height: 1.2;
}

@media (min-width: 30rem) {
	.sl-choices--many {
		grid-template-columns: repeat(3, 1fr);
	}
}

.sl-choice {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	min-height: 7rem;
	padding: 0.75rem 0.5rem;
	background: var(--sl-surface);
	border: 2px solid var(--sl-line);
	border-radius: 0.875rem;
	color: var(--sl-ink);
	font-size: 1rem;
	cursor: pointer;
	transition: border-color 120ms ease, background-color 120ms ease;
}

/* Selection is shown by border *and* tick *and* weight, never colour alone:
   colour-blindness and a sunlit screen both flattens hue. */
.sl-choice.is-selected {
	border-color: var(--sl-accent);
	background: #eaf2ff;
	box-shadow: inset 0 0 0 2px var(--sl-accent);
}

.sl-choice.is-selected .sl-choice__label {
	font-weight: 700;
}

.sl-choice.is-selected::after {
	content: "\2713";
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--sl-accent);
}

.sl-choice:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 3px;
}

.sl-choice__icon {
	font-size: 2.25rem;
	line-height: 1;
}

.sl-choice__label {
	text-align: center;
}

.sl-choice__help {
	font-size: 0.875rem;
	color: var(--sl-muted);
}

/* ------------------------------------------------------------ photo capture */

.sl-photo {
	margin-top: 1.75rem;
}

.sl-photo__button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	min-height: 4.5rem;
	background: var(--sl-surface);
	border: 2px dashed var(--sl-line);
	border-radius: 0.875rem;
	font-size: 1.25rem;
	font-weight: 600;
	cursor: pointer;
}

.sl-photo__button:focus-within {
	outline: 3px solid var(--sl-accent);
	outline-offset: 3px;
}

.sl-photo__icon {
	font-size: 2rem;
}

.sl-photo__preview {
	position: relative;
	margin: 0.75rem 0 0;
}

.sl-photo__preview img {
	display: block;
	width: 100%;
	max-height: 18rem;
	object-fit: cover;
	border-radius: 0.875rem;
	border: 2px solid var(--sl-line);
}

.sl-photo__clear {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 2.75rem;
	height: 2.75rem;
	border: none;
	border-radius: 50%;
	background: rgba(20, 33, 61, 0.72);
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

/* ------------------------------------------------------------------ textarea */

.sl-label {
	display: block;
	margin: 1.75rem 0 0.5rem;
	font-size: 1.125rem;
	font-weight: 600;
}

.sl-textarea {
	width: 100%;
	padding: 0.875rem;
	font-size: 1.125rem;
	font-family: inherit;
	color: var(--sl-ink);
	background: var(--sl-surface);
	border: 2px solid var(--sl-line);
	border-radius: 0.875rem;
	resize: vertical;
}

.sl-textarea:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 2px;
	border-color: var(--sl-accent);
}

/* ----------------------------------------------------------------- the picker */
/* The one control on the form that is a real field rather than a set of buttons:
   who is reporting. Weighted like the textarea, so it reads as one of the
   answers rather than as chrome. The native chevron is left alone - it is what
   the reader already knows from every other app on the phone. */

.sl-label--field {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.sl-label__icon {
	font-size: 1.25rem;
	line-height: 1;
}

.sl-select {
	width: 100%;
	min-height: 3.75rem;
	padding: 0.75rem 0.875rem;
	font-size: 1.125rem;
	font-family: inherit;
	color: var(--sl-ink);
	background-color: var(--sl-surface);
	border: 2px solid var(--sl-line);
	border-radius: 0.875rem;
}

.sl-select:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 2px;
	border-color: var(--sl-accent);
}

/* ------------------------------------------------------------------- actions */

.sl-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.625rem;
	width: 100%;
	min-height: 4.5rem;
	margin-top: 1.75rem;
	padding: 0.75rem 1rem;
	background: var(--sl-accent);
	color: var(--sl-accent-ink);
	border: none;
	border-radius: 0.875rem;
	font-family: inherit;
	font-size: 1.5rem;
	font-weight: 700;
	cursor: pointer;
}

.sl-submit:hover {
	filter: brightness(1.06);
}

.sl-submit:focus-visible {
	outline: 3px solid var(--sl-ink);
	outline-offset: 3px;
}

/* A dead button that only dims is a lie; this one says so in words too. */
.sl-submit[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

.sl-alert {
	margin: 1rem 0 0;
	padding: 0.875rem 1rem;
	border-radius: 0.75rem;
	background: #fdecea;
	border: 2px solid var(--sl-warn);
	color: var(--sl-warn);
	font-size: 1.0625rem;
	font-weight: 600;
}

/* --------------------------------------------------------------- confirmation */

.sl-done {
	text-align: center;
	padding: 2rem 1rem;
	background: var(--sl-surface);
	border: 2px solid var(--sl-line);
	border-radius: 1rem;
}

.sl-done__tick {
	width: 6rem;
	height: 6rem;
	margin: 0 auto 1rem;
	border-radius: 50%;
	background: var(--sl-good);
	color: #fff;
	font-size: 3.5rem;
	line-height: 6rem;
}

.sl-done__title {
	font-size: 1.625rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
}

.sl-done__ref {
	color: var(--sl-muted);
	margin: 0;
	font-size: 1.125rem;
}

/* --------------------------------------------------------------- logging out */

/* The way out. Quiet on the button page - the tile above is what the user came
   for - and the primary action on the confirmation panel, where the job is to
   hand the phone to the next person rather than to admire the tick. */
.sl-foot {
	margin-top: 2rem;
	text-align: center;
}

.sl-logout {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 3.25rem;
	padding: 0.5rem 1.25rem;
	border: 2px solid var(--sl-line);
	border-radius: 0.875rem;
	background: var(--sl-surface);
	color: var(--sl-muted);
	font-size: 1.125rem;
	font-weight: 600;
}

.sl-logout:hover,
.sl-logout:focus {
	border-color: var(--sl-accent);
	color: var(--sl-ink);
}

.sl-logout:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 3px;
}

.sl-logout__icon {
	font-size: 1.375rem;
	line-height: 1;
}

/* Filled and full width when it is the point of the screen. */
.sl-done .sl-logout {
	width: 100%;
	min-height: 4.5rem;
	margin-top: 1.5rem;
	border-color: var(--sl-accent);
	background: var(--sl-accent);
	color: var(--sl-accent-ink);
	font-size: 1.375rem;
}

.sl-done .sl-logout:hover,
.sl-done .sl-logout:focus {
	border-color: var(--sl-accent);
	color: var(--sl-accent-ink);
	filter: brightness(1.06);
}

/* The quieter second option on the confirmation panel. */
.sl-again {
	display: inline-block;
	margin-top: 1.25rem;
	color: var(--sl-muted);
	font-size: 1.0625rem;
	text-decoration: underline;
}

/* --------------------------------------------------------------- utilities */

/* The `hidden` attribute must beat the display rules above - several elements
   here are `display: flex`, which would otherwise keep a hidden panel on screen
   (the "Back" link once the report has been filed). */
.sl-portal [hidden] {
	display: none !important;
}

/* Used for the file input, which must stay focusable and clickable-by-label. */
.sl-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ reports */
/* The customer's own reports, on the home page. Each row is one tap to the
   updates, so the whole row is the target. */

.sl-reports {
	margin-top: 2rem;
}

.sl-reports__title {
	margin: 0 0 0.75rem;
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--sl-muted);
}

.sl-reports__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.625rem;
}

.sl-report {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	min-height: 4.5rem;
	padding: 0.75rem 0.875rem;
	border: 2px solid var(--sl-line);
	border-radius: 1rem;
	background: var(--sl-surface);
	color: var(--sl-ink);
}

.sl-report:hover,
.sl-report:focus {
	border-color: var(--sl-accent);
}

.sl-report:focus-visible {
	outline: 3px solid var(--sl-accent);
	outline-offset: 2px;
}

/* The state chip: icon first, on its tinted disc. */
.sl-report__state,
.sl-rhead__state {
	--sl-tone: var(--sl-tone-calm);
	--sl-tone-bg: var(--sl-tone-calm-bg);
}

.sl-state--calm {
	--sl-tone: var(--sl-tone-calm);
	--sl-tone-bg: var(--sl-tone-calm-bg);
}

.sl-state--busy {
	--sl-tone: var(--sl-tone-busy);
	--sl-tone-bg: var(--sl-tone-busy-bg);
}

.sl-state--held {
	--sl-tone: var(--sl-tone-held);
	--sl-tone-bg: var(--sl-tone-held-bg);
}

.sl-state--good {
	--sl-tone: var(--sl-tone-good);
	--sl-tone-bg: var(--sl-tone-good-bg);
}

.sl-report__state {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background: var(--sl-tone-bg);
	font-size: 1.5rem;
	line-height: 1;
}

.sl-report__body {
	flex: 1 1 auto;
	min-width: 0;
	display: grid;
	gap: 0.15rem;
}

.sl-report__what {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 1.125rem;
	font-weight: 600;
}

.sl-report__icon {
	font-size: 1.25rem;
	line-height: 1;
}

.sl-report__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	color: var(--sl-muted);
	font-size: 0.9375rem;
}

.sl-report__state-word {
	font-weight: 700;
	color: var(--sl-tone);
}

.sl-report__age {
	margin-left: auto;
}

.sl-report__update {
	color: var(--sl-accent);
	font-size: 0.9375rem;
	font-weight: 600;
}

.sl-report__go {
	flex: 0 0 auto;
	color: var(--sl-muted);
	font-size: 1.75rem;
	line-height: 1;
}

/* --------------------------------------------------------------- one report */

.sl-portal--report {
	max-width: 38rem;
}

.sl-rhead {
	text-align: center;
	padding: 0.5rem 0 1.5rem;
}

.sl-rhead__state {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 1rem 0.4rem 0.5rem;
	border-radius: 999px;
	background: var(--sl-tone-bg);
	color: var(--sl-tone);
	font-size: 1.125rem;
	font-weight: 700;
}

.sl-rhead__icon {
	font-size: 1.75rem;
	line-height: 1;
}

.sl-rhead__sentence {
	margin: 0.875rem 0 0.25rem;
	font-size: 1.75rem;
	font-weight: 700;
}

.sl-rhead__help {
	margin: 0;
	color: var(--sl-muted);
	font-size: 1.0625rem;
}

.sl-what,
.sl-updates {
	margin-top: 1.5rem;
	padding: 1rem;
	border: 2px solid var(--sl-line);
	border-radius: 1rem;
	background: var(--sl-surface);
}

.sl-what__title,
.sl-updates__title {
	margin: 0 0 0.625rem;
	font-size: 1rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--sl-muted);
}

.sl-what__line {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.sl-what__icon {
	font-size: 1.5rem;
	line-height: 1;
}

.sl-what__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	margin: 0.5rem 0 0;
	color: var(--sl-muted);
	font-size: 0.9375rem;
}

.sl-what__urgent {
	padding: 0 0.5rem;
	border-radius: 999px;
	background: #fdecea;
	color: var(--sl-warn);
	font-weight: 700;
}

.sl-what__ref {
	font-variant-numeric: tabular-nums;
}

.sl-what__note {
	margin: 0.75rem 0 0;
	padding-top: 0.75rem;
	border-top: 1px solid var(--sl-line);
	font-size: 1.0625rem;
}

.sl-what__photo {
	margin: 0.875rem 0 0;
}

.sl-what__photo img {
	max-width: 100%;
	height: auto;
	border-radius: 0.75rem;
}

.sl-updates__none {
	margin: 0;
	color: var(--sl-muted);
}

.sl-updates__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.75rem;
}

.sl-update {
	padding: 0.75rem 0.875rem;
	border-radius: 0.75rem;
	background: var(--sl-tone-calm-bg);
}

/* The customer's own words sit apart from ours, so a reply is never mistaken
   for something they said. */
.sl-update--me {
	background: var(--sl-tone-held-bg);
}

.sl-update__who {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 0 0 0.25rem;
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--sl-muted);
}

.sl-update__text {
	margin: 0;
	font-size: 1.0625rem;
	white-space: pre-wrap;
}

.sl-resolution {
	margin-top: 0.875rem;
	padding-top: 0.875rem;
	border-top: 1px solid var(--sl-line);
}

.sl-resolution__title {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 700;
	color: var(--sl-good);
}

.sl-resolution__text {
	margin: 0;
}

/* ------------------------------------------------------- a report that is gone */

.sl-missing {
	text-align: center;
	padding: 2rem 0;
}

.sl-missing__icon {
	font-size: 3rem;
	line-height: 1;
}

.sl-missing__title {
	margin: 0.75rem 0 0.25rem;
	font-size: 1.375rem;
}

.sl-missing__help {
	margin: 0 0 1.25rem;
	color: var(--sl-muted);
}

@media (prefers-reduced-motion: reduce) {
	.sl-tile,
	.sl-choice {
		transition: none;
	}

	.sl-tile:hover,
	.sl-tile:focus {
		transform: none;
	}
}
