/*
 * Fitzroy Waterwatch data-entry app shell.
 *
 * Loaded only by layout/community-header.php. Supplies the chrome that the trimmed
 * layout no longer inherits from Avada (app bar, network status, install affordance,
 * footer) plus the few utility rules that lived in fusion-styles.min.css.
 *
 * Colours are the riverhealth2019 theme's own: #193c42 dark, #32acbc teal,
 * #0c8382 green-teal. Nothing here is meant to look new -- the goal is that these
 * four pages read as the same site with the site nav removed.
 *
 * Deliberately does NOT re-implement 960.css's container_12 / grid_10 / grid_4.
 * layout/header.php never loaded 960.css either, so those classes are already inert
 * on these pages today; adding them here would be a silent visual change.
 */

:root {
	--ww-dark: #193c42;
	--ww-teal: #32acbc;
	--ww-green: #0c8382;
	--ww-pale: #e2f2f0;
	--ww-grey: #a9b7c0;
}

/* fusion-styles.min.css defined no .wrapper rule, so this is additive, not a
   replacement -- it just stops the content going full-bleed on desktop. */
.ww-body .wrapper {
	max-width: 1100px;
	margin: 0 auto;
	background: #fff;
}

.ww-body {
	background: #f4f7f8;
}

/* ---------- app bar ---------- */

.ww-appbar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.9rem;
	background: var(--ww-dark);
	position: sticky;
	top: 0;
	z-index: 100;
	/* keeps the bar clear of the iOS notch in standalone mode */
	padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
}

.ww-appbar-back {
	color: #fff;
	font-size: 1.1rem;
	line-height: 1;
	padding: 0.5rem 0.6rem;
	border-radius: 4px;
	text-decoration: none;
	flex: 0 0 auto;
}

.ww-appbar-back:hover,
.ww-appbar-back:focus {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
}

.ww-appbar-logo {
	flex: 1 1 auto;
	min-width: 0;
	line-height: 0;
}

.ww-appbar-logo img {
	height: 42px;
	width: auto;
	max-width: 100%;
}

.ww-install {
	flex: 0 0 auto;
	background: var(--ww-teal);
	color: #fff;
	border: 0;
	border-radius: 4px;
	padding: 0.5rem 0.85rem;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.ww-install:hover,
.ww-install:focus {
	background: #2795a3;
}

/* ---------- network / sync status strip ---------- */

.ww-status {
	padding: 0.6rem 0.9rem;
	font-size: 0.9rem;
	text-align: center;
	background: var(--ww-pale);
	color: var(--ww-dark);
	border-bottom: 1px solid #cfe4e1;
}

.ww-status[data-state="offline"] {
	background: #fdf3d8;
	border-bottom-color: #eeddab;
}

.ww-status[data-state="syncing"] {
	background: var(--ww-pale);
}

.ww-status[data-state="error"] {
	background: #fbe3e3;
	border-bottom-color: #f0c2c2;
}

.ww-status button {
	margin-left: 0.6rem;
	background: var(--ww-green);
	color: #fff;
	border: 0;
	border-radius: 3px;
	padding: 0.3rem 0.7rem;
	font-size: 0.85rem;
	cursor: pointer;
}

/* ---------- iOS "add to home screen" hint ---------- */

.ww-ios-hint {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.65rem 0.9rem;
	background: var(--ww-pale);
	color: var(--ww-dark);
	font-size: 0.9rem;
}

.ww-ios-hint .ww-dismiss {
	margin-left: auto;
	background: none;
	border: 0;
	font-size: 1.3rem;
	line-height: 1;
	color: var(--ww-dark);
	cursor: pointer;
	padding: 0 0.3rem;
}

/* ---------- flash messages ----------
   .boxcontext comes from the theme's style.css; only the state colouring was
   supplied elsewhere, so just the accent border is restored here. */

.flash {
	border-left: 4px solid var(--ww-grey);
}

.flash-success { border-left-color: var(--ww-green); }
.flash-error   { border-left-color: #c0392b; }
.flash-information { border-left-color: var(--ww-teal); }

/* ---------- footer ---------- */

.ww-footer {
	background: var(--ww-dark);
	color: #dfeaec;
	padding: 1.25rem 0.9rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
	text-align: center;
	font-size: 0.9rem;
}

.ww-footer-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.25rem;
	margin-bottom: 0.75rem;
}

.ww-footer-links a {
	color: #95d7e3;
	text-decoration: none;
}

.ww-footer-links a:hover,
.ww-footer-links a:focus {
	text-decoration: underline;
	color: #fff;
}

.ww-footer-org {
	margin: 0;
	color: var(--ww-grey);
	font-size: 0.82rem;
}

/* ---------- accessibility ---------- */

.skip-link.screen-reader-text {
	position: absolute;
	left: -9999px;
	top: 0;
}

.skip-link.screen-reader-text:focus {
	left: 0;
	z-index: 200;
	background: #fff;
	color: var(--ww-dark);
	padding: 0.6rem 1rem;
}

/* Targets are used one-handed, outdoors, often wet. Keep them thumb-sized. */
@media (max-width: 800px) {
	.ww-appbar-logo img { height: 34px; }

	.ww-body input[type="text"],
	.ww-body input[type="number"],
	.ww-body input[type="email"],
	.ww-body select,
	.ww-body textarea {
		font-size: 16px; /* stops iOS Safari zooming the viewport on focus */
		min-height: 44px;
	}

	.ww-body input[type="submit"],
	.ww-body button {
		min-height: 44px;
	}
}

/* ---------- offline wizard ----------
   Only rendered when the device is offline; online, the server templates own the page. */

.ww-offline-note {
	background: #fdf3d8;
	border-left: 4px solid #e0b94a;
	padding: 0.75rem 1rem;
	margin: 0 0 1rem;
	font-size: 0.92rem;
}

.ww-type-list,
.ww-site-list {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
}

.ww-type-list li { margin-bottom: 0.6rem; }

.ww-site-list {
	max-height: 22rem;
	overflow-y: auto;
	border: 1px solid #d8e3e5;
	border-radius: 4px;
	padding: 0.5rem;
}

.ww-site-list li { border-bottom: 1px solid #eef4f5; }
.ww-site-list li:last-child { border-bottom: 0; }

/* Big hit areas: this is used one-handed, outdoors, often with wet fingers. */
.ww-site-list label {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.7rem 0.4rem;
	cursor: pointer;
	margin: 0;
}

.ww-site-list input[type="radio"] {
	width: 1.15rem;
	height: 1.15rem;
	flex: 0 0 auto;
}

#ww-app fieldset {
	border: 1px solid #d8e3e5;
	border-radius: 4px;
	padding: 0.9rem;
	margin-bottom: 1rem;
}

#ww-app fieldset legend { padding: 0 0.4rem; font-weight: 600; }

#ww-app fieldset label {
	display: block;
	margin-bottom: 0.6rem;
}

#ww-app fieldset input[type="text"] {
	display: block;
	width: 100%;
	max-width: 22rem;
}

.ww-error {
	color: #c0392b;
	font-weight: 600;
	margin: 0.5rem 0;
}

/* Replaces the Google Map when it cannot load. */
.ww-map-offline {
	background: var(--ww-pale);
	border: 1px dashed #9bc4c0;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

/*
 * The page-title band, made survivable offline.
 *
 * riverhealth2019's style.css backs .page_title_container with
 * /wp-content/uploads/header-river.jpg and sets h1.page_title to
 * `color:#fff; line-height:300px`. That JPEG is referenced from INSIDE the stylesheet,
 * so no <link> in community-header.php names it and nothing in the worker's SHELL
 * covered it -- offline it failed, and every app page opened with a 300px blank white
 * band and a white-on-white, invisible heading.
 *
 * The JPEG cannot be replaced in place: riverhealth2015 and enviroscore2018 reference
 * the same file, so re-encoding it would change the EHI catchment pages too. These four
 * Waterwatch pages get their own 1400px WebP instead -- 80 KB, 9% of the 838 KB original
 * -- which IS precached.
 *
 * background-color is not decoration. It is declared so that if this image is ever lost
 * as well, the band stays dark and the white title stays readable: the failure degrades
 * instead of erasing the heading.
 */
.ww-body .page_title_container {
	background-color: var(--ww-dark);
	background-image: url(../img/ww-header-river.webp);
}
