/**
 * Bulldogs Volunteers — front end.
 *
 * Scoped under .bv-app so it does not fight the theme. Colours come from
 * the two CSS variables set in Settings.
 */

.bv-app {
	--bv-primary: #00195B;
	--bv-accent: #AB161C;
	--bv-ink: #14171f;
	--bv-muted: #5c6472;
	--bv-line: #dfe3ea;
	--bv-surface: #ffffff;
	--bv-sunk: #f5f7fa;
	--bv-ok: #12805c;
	--bv-radius: 10px;

	box-sizing: border-box;
	color: var(--bv-ink);
	font-size: 16px;
	line-height: 1.5;
	max-width: 1100px;
	margin: 0 auto;

	/* Stop iOS inflating text in landscape, and kill the grey tap flash. */
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: rgba(0, 25, 91, 0.15);
}

.bv-app *,
.bv-app *::before,
.bv-app *::after {
	box-sizing: inherit;
}

/* --------------------------------------------------------- Brand marks */

/*
 * The club's material runs heavy condensed uppercase over navy, with a red
 * angled slash. Reproduced here with weight, tracking and case rather than a
 * downloaded font, so nothing external has to load and the theme's own
 * typeface still carries through.
 */
.bv-app__brand {
	align-items: center;
	background: var(--bv-primary);
	border-radius: var(--bv-radius) var(--bv-radius) 0 0;
	display: flex;
	gap: 14px;
	margin-bottom: 22px;
	overflow: hidden;
	padding: 16px 20px;
	position: relative;
}

/* The angled red slash off the top-left corner. */
.bv-app__brand::before {
	background: var(--bv-accent);
	content: "";
	height: 200%;
	left: -30px;
	position: absolute;
	top: -50%;
	transform: skewX(-18deg);
	width: 14px;
}

.bv-app__logo {
	flex-shrink: 0;
	height: auto;
	max-height: 54px;
	width: auto;
}

.bv-app__brand-text {
	position: relative;
}

.bv-app__club {
	color: #fff;
	font-size: 1.15rem;
	font-weight: 900;
	letter-spacing: 0.06em;
	line-height: 1.1;
	margin: 0;
	text-transform: uppercase;
}

.bv-app__tagline {
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	margin: 4px 0 0;
	text-transform: uppercase;
}

/* ---------------------------------------------------------------- Head */

.bv-head {
	align-items: flex-end;
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	justify-content: space-between;
	margin-bottom: 20px;
}

.bv-head__title {
	font-size: 1.5rem;
	font-weight: 900;
	letter-spacing: 0.01em;
	line-height: 1.2;
	margin: 0;
	text-transform: uppercase;
}

.bv-head__dates {
	color: var(--bv-muted);
	margin: 4px 0 0;
}

.bv-weeknav {
	background: var(--bv-sunk);
	border-radius: 999px;
	display: inline-flex;
	gap: 2px;
	padding: 4px;
}

.bv-weeknav__btn {
	align-items: center;
	border-radius: 999px;
	color: var(--bv-muted);
	display: inline-flex;
	font-size: 0.9rem;
	font-weight: 600;
	justify-content: center;
	min-height: 40px;
	padding: 7px 18px;
	text-decoration: none;
}

.bv-weeknav__btn.is-active {
	background: var(--bv-surface);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	color: var(--bv-primary);
}

/* ------------------------------------------------------------- Summary */

.bv-summary {
	background: var(--bv-sunk);
	border-radius: var(--bv-radius);
	margin-bottom: 28px;
	padding: 16px 18px;
}

.bv-summary__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: space-between;
	margin-bottom: 10px;
}

.bv-summary__count {
	font-weight: 700;
}

.bv-summary__gap {
	color: var(--bv-accent);
	font-weight: 600;
}

.bv-summary.is-done .bv-summary__gap {
	color: var(--bv-ok);
}

.bv-bar {
	background: #dbe0e8;
	border-radius: 999px;
	height: 9px;
	overflow: hidden;
}

.bv-bar__fill {
	background: var(--bv-primary);
	border-radius: 999px;
	display: block;
	height: 100%;
	transition: width 0.3s ease;
}

.bv-summary.is-done .bv-bar__fill {
	background: var(--bv-ok);
}

/* ------------------------------------------------------------ Filter */

/*
 * On a phone, a mostly-covered week means scrolling past a dozen "Filled"
 * cards to reach the two that still need somebody. This flips the list to
 * open jobs only.
 */
.bv-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: -14px 0 22px;
}

.bv-filter__btn {
	background: #fff;
	border: 1px solid var(--bv-line);
	border-radius: 999px;
	color: var(--bv-muted);
	cursor: pointer;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 700;
	min-height: 40px;
	padding: 8px 16px;
}

.bv-filter__btn[aria-pressed="true"] {
	background: var(--bv-primary);
	border-color: var(--bv-primary);
	color: #fff;
}

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

.bv-app.is-filtered .bv-card.is-full,
.bv-app.is-filtered .bv-round.is-empty {
	display: none;
}

/* -------------------------------------------------------------- Rounds */

.bv-round {
	margin-bottom: 36px;
}

.bv-round__head {
	border-bottom: 2px solid var(--bv-line);
	margin-bottom: 18px;
	padding-bottom: 12px;
}

.bv-pill {
	border-radius: 4px;
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	margin-bottom: 8px;
	padding: 3px 9px;
	text-transform: uppercase;
}

.bv-pill--home {
	background: var(--bv-primary);
	color: #fff;
}

.bv-pill--away {
	background: var(--bv-accent);
	color: #fff;
}

.bv-round__title {
	font-size: 1.25rem;
	font-weight: 900;
	letter-spacing: 0.01em;
	margin: 0;
	text-transform: uppercase;
}

.bv-round__vs {
	color: var(--bv-muted);
	font-weight: 700;
}

.bv-round__meta {
	color: var(--bv-muted);
	font-size: 0.9rem;
	margin: 4px 0 0;
}

.bv-round__notes {
	background: var(--bv-sunk);
	border-left: 3px solid var(--bv-primary);
	font-size: 0.9rem;
	margin: 10px 0 0;
	padding: 8px 12px;
}

/* --------------------------------------------------------------- Cards */

.bv-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.bv-card {
	background: var(--bv-surface);
	border: 1px solid var(--bv-line);
	border-radius: var(--bv-radius);
	display: flex;
	flex-direction: column;
	padding: 16px;
}

.bv-card.is-open {
	border-left: 4px solid var(--bv-accent);
}

.bv-card.is-full {
	background: var(--bv-sunk);
	border-left: 4px solid var(--bv-ok);
}

.bv-card__top {
	align-items: flex-start;
	display: flex;
	gap: 10px;
	justify-content: space-between;
}

.bv-card__title {
	font-size: 1.03rem;
	font-weight: 800;
	line-height: 1.3;
	margin: 0;
}

.bv-status {
	border-radius: 4px;
	flex-shrink: 0;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.03em;
	padding: 3px 8px;
	text-transform: uppercase;
	white-space: nowrap;
}

.bv-status--open {
	background: #fdecef;
	color: var(--bv-accent);
}

.bv-status--full {
	background: #e3f4ee;
	color: var(--bv-ok);
}

.bv-card__when {
	color: var(--bv-muted);
	font-size: 0.87rem;
	font-weight: 600;
	margin: 6px 0 0;
}

.bv-card__summary {
	font-size: 0.9rem;
	margin: 8px 0 0;
}

.bv-card__count {
	color: var(--bv-muted);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	margin: 12px 0 4px;
	text-transform: uppercase;
}

.bv-names {
	list-style: none;
	margin: 0 0 14px;
	padding: 0;
}

.bv-names li {
	border-bottom: 1px dashed var(--bv-line);
	font-size: 0.92rem;
	padding: 5px 0;
}

.bv-names li:last-child {
	border-bottom: 0;
}

.bv-names__empty {
	color: #9aa2b1;
	font-style: italic;
}

.bv-mine {
	background: #e3f4ee;
	border-radius: 6px;
	font-size: 0.85rem;
	margin: 0 0 10px;
	padding: 7px 10px;
}

.bv-mine span {
	font-weight: 700;
}

.bv-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
}

/* ------------------------------------------------------------- Buttons */

.bv-app .bv-btn {
	align-items: center;
	background: none;
	border: 1px solid transparent;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	justify-content: center;
	line-height: 1.2;
	/* 44px is the smallest reliable thumb target. */
	min-height: 44px;
	padding: 10px 16px;
	text-align: center;
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.bv-app .bv-btn--primary {
	background: var(--bv-primary);
	color: #fff;
}

.bv-app .bv-btn--primary:hover:not(:disabled) {
	opacity: 0.88;
}

.bv-app .bv-btn--ghost {
	border-color: var(--bv-line);
	color: var(--bv-muted);
}

.bv-app .bv-btn--ghost:hover {
	border-color: var(--bv-muted);
	color: var(--bv-ink);
}

.bv-app .bv-btn:disabled {
	background: #c9cfd9;
	color: #fff;
	cursor: not-allowed;
}

.bv-app .bv-btn:focus-visible,
.bv-app .bv-linkbtn:focus-visible {
	outline: 3px solid var(--bv-accent);
	outline-offset: 2px;
}

.bv-linkbtn {
	background: none;
	border: 0;
	color: var(--bv-primary);
	cursor: pointer;
	font: inherit;
	padding: 0;
	text-decoration: underline;
}

/* ----------------------------------------------------------------- SOP */

.bv-sop {
	border-top: 1px solid var(--bv-line);
	font-size: 0.88rem;
	margin-top: 14px;
	padding-top: 12px;
}

.bv-sop__block + .bv-sop__block {
	margin-top: 12px;
}

.bv-sop__label {
	color: var(--bv-muted);
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	margin: 0 0 4px;
	text-transform: uppercase;
}

.bv-sop__block p {
	margin: 0;
}

.bv-sop__steps {
	margin: 0;
	padding-left: 18px;
}

.bv-sop__steps li {
	margin-bottom: 4px;
}

.bv-sop__headsup {
	background: #fff6e6;
	border-left: 3px solid #d98a00;
	border-radius: 0 6px 6px 0;
	margin-top: 14px;
	padding: 9px 12px;
}

/* -------------------------------------------------------------- Modal */

.bv-modal {
	align-items: center;
	display: flex;
	inset: 0;
	justify-content: center;
	padding: 20px;
	position: fixed;
	z-index: 99999;
}

.bv-modal[hidden] {
	display: none;
}

.bv-modal__backdrop {
	background: rgba(14, 18, 26, 0.62);
	inset: 0;
	position: absolute;
}

.bv-modal__panel {
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
	max-height: 90vh;
	max-width: 440px;
	/* Keep a flick inside the sheet from scrolling the page behind it. */
	overscroll-behavior: contain;
	overflow-y: auto;
	padding: 26px;
	position: relative;
	-webkit-overflow-scrolling: touch;
	width: 100%;
}

/* dvh tracks the mobile browser chrome as it hides and shows. */
@supports (max-height: 90dvh) {
	.bv-modal__panel {
		max-height: 90dvh;
	}
}

.bv-modal__panel:focus {
	outline: none;
}

.bv-modal__x {
	background: none;
	border: 0;
	color: var(--bv-muted);
	cursor: pointer;
	font-size: 1.7rem;
	line-height: 1;
	padding: 4px 8px;
	position: absolute;
	right: 12px;
	top: 12px;
}

.bv-modal__title {
	font-size: 1.25rem;
	margin: 0 30px 6px 0;
}

.bv-modal__job {
	color: var(--bv-primary);
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0;
}

.bv-modal__when {
	color: var(--bv-muted);
	font-size: 0.9rem;
	margin: 2px 0 18px;
}

body.bv-modal-open {
	overflow: hidden;
}

/* --------------------------------------------------------------- Form */

.bv-field {
	display: block;
	margin-bottom: 15px;
}

.bv-field__label {
	display: block;
	font-size: 0.85rem;
	font-weight: 700;
	margin-bottom: 5px;
}

.bv-field__label em {
	color: var(--bv-muted);
	font-style: normal;
	font-weight: 400;
}

.bv-app .bv-field input {
	border: 1px solid var(--bv-line);
	border-radius: 6px;
	font-family: inherit;
	font-size: 1rem;
	padding: 11px 12px;
	width: 100%;
}

.bv-app .bv-field input:focus {
	border-color: var(--bv-primary);
	outline: 2px solid rgba(0, 25, 91, 0.25);
}

.bv-field__hint {
	color: var(--bv-muted);
	display: block;
	font-size: 0.78rem;
	margin-top: 4px;
}

/* Honeypot — off screen rather than display:none, which some bots detect. */
.bv-hp {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 0;
}

.bv-form__msg {
	margin: 0 0 12px;
	min-height: 1.2em;
	font-size: 0.9rem;
}

.bv-form__msg.is-error {
	color: var(--bv-accent);
	font-weight: 600;
}

.bv-form__msg.is-success {
	color: var(--bv-ok);
	font-weight: 600;
}

.bv-form__actions {
	display: flex;
	gap: 8px;
}

.bv-form__actions .bv-btn {
	flex: 1;
}

/* -------------------------------------------------------------- Share */

.bv-share {
	background: var(--bv-sunk);
	border-radius: var(--bv-radius);
	margin-top: 8px;
	padding: 20px;
}

.bv-share__title {
	font-size: 1.05rem;
	margin: 0 0 4px;
}

.bv-share__lead {
	color: var(--bv-muted);
	font-size: 0.9rem;
	margin: 0 0 14px;
}

.bv-share__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bv-share__buttons .bv-btn--ghost {
	background: #fff;
}

.bv-share__preview {
	font-size: 0.87rem;
	margin-top: 14px;
}

.bv-share__preview summary {
	color: var(--bv-primary);
	cursor: pointer;
	font-weight: 600;
}

.bv-share__text {
	background: #fff;
	border: 1px solid var(--bv-line);
	border-radius: 6px;
	font-size: 0.83rem;
	margin-top: 10px;
	overflow-x: auto;
	padding: 12px;
	white-space: pre-wrap;
	word-break: break-word;
}

/* -------------------------------------------------------------- Empty */

.bv-empty {
	background: var(--bv-sunk);
	border-radius: var(--bv-radius);
	padding: 34px 20px;
	text-align: center;
}

.bv-empty p {
	margin: 0 0 6px;
}

/* --------------------------------------------------------- SOP library */

.bv-sops__heading {
	border-bottom: 2px solid var(--bv-line);
	font-size: 1.2rem;
	margin: 30px 0 12px;
	padding-bottom: 8px;
}

.bv-sops__item {
	border: 1px solid var(--bv-line);
	border-radius: var(--bv-radius);
	margin-bottom: 8px;
	padding: 12px 16px;
}

.bv-sops__item summary {
	align-items: baseline;
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: space-between;
}

.bv-sops__name {
	font-weight: 700;
}

.bv-sops__when {
	color: var(--bv-muted);
	font-size: 0.85rem;
}

.bv-sops__summary {
	font-size: 0.92rem;
	margin: 0 0 10px;
}

.bv-sops__item .bv-sop {
	border-top: 0;
	padding-top: 12px;
}

/* -------------------------------------------------------------- Board */

.bv-board {
	border-collapse: collapse;
	width: 100%;
}

.bv-board__caption {
	caption-side: top;
	color: var(--bv-muted);
	font-size: 0.88rem;
	padding-bottom: 12px;
	text-align: left;
}

.bv-board th,
.bv-board td {
	border-bottom: 1px solid var(--bv-line);
	padding: 10px 12px;
	text-align: left;
}

.bv-board thead th {
	background: var(--bv-sunk);
	font-size: 0.75rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.bv-board__podium td {
	background: #fffaf0;
	font-weight: 600;
}

.bv-board td:first-child {
	color: var(--bv-muted);
	font-weight: 700;
	width: 3rem;
}

/* --------------------------------------------------------------- Small */

/* --------------------------------------------------------------- Phone */

/*
 * Most people open this from a link in the team Messenger chat, on a phone,
 * standing somewhere with one bar of signal. Everything below is aimed at
 * getting the first job on screen fast and making every target thumb-sized.
 */
@media (max-width: 700px) {
	.bv-app__brand {
		gap: 11px;
		margin-bottom: 18px;
		padding: 12px 16px;
	}

	.bv-app__logo {
		max-height: 40px;
	}

	.bv-app__club {
		font-size: 1rem;
	}

	.bv-app__tagline {
		font-size: 0.62rem;
		letter-spacing: 0.1em;
	}

	.bv-head {
		align-items: stretch;
		flex-direction: column;
		gap: 12px;
		margin-bottom: 16px;
	}

	.bv-head__title {
		font-size: 1.25rem;
	}

	/* The round heading below already carries the date. */
	.bv-head__dates {
		display: none;
	}

	.bv-weeknav {
		justify-content: stretch;
	}

	.bv-weeknav__btn {
		flex: 1;
		min-height: 44px;
	}

	/* Keep the spots-remaining count in view while scrolling the list. */
	.bv-summary {
		background: rgba(245, 247, 250, 0.96);
		backdrop-filter: blur(6px);
		margin-bottom: 18px;
		padding: 12px 14px;
		position: sticky;
		top: 0;
		z-index: 5;
	}

	.bv-summary__row {
		font-size: 0.92rem;
		margin-bottom: 8px;
	}

	.bv-filter {
		margin: -8px 0 18px;
	}

	.bv-filter__btn {
		flex: 1;
		min-height: 44px;
	}

	.bv-round {
		margin-bottom: 26px;
	}

	/* Pull the Home/Away pill up beside the heading instead of above it. */
	.bv-round__head {
		margin-bottom: 14px;
		padding-bottom: 10px;
		padding-right: 68px;
		position: relative;
	}

	.bv-pill {
		margin-bottom: 0;
		position: absolute;
		right: 0;
		top: 2px;
	}

	.bv-round__title {
		font-size: 1.12rem;
	}

	.bv-round__notes {
		margin-top: 8px;
		padding: 7px 10px;
	}

	.bv-grid {
		gap: 12px;
		grid-template-columns: 1fr;
	}

	.bv-card {
		padding: 14px;
	}

	/* Full-width primary action — the easiest thing on the card to hit. */
	.bv-card__actions {
		flex-direction: column;
	}

	.bv-card__actions .bv-btn {
		width: 100%;
	}

	.bv-share__buttons {
		flex-direction: column;
	}

	.bv-share__buttons .bv-btn {
		width: 100%;
	}

	/* Sheet from the bottom, clear of the iOS home indicator. */
	.bv-modal {
		align-items: flex-end;
		padding: 0;
	}

	.bv-modal__panel {
		border-radius: 14px 14px 0 0;
		max-height: 92vh;
		max-width: none;
		padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
	}

	.bv-modal__x {
		font-size: 2rem;
		padding: 8px 12px;
	}

	.bv-form__actions {
		flex-direction: column-reverse;
	}

	.bv-form__actions .bv-btn {
		width: 100%;
	}

	/* Wide tables scroll inside themselves, never the page. */
	.bv-app--board {
		overflow-x: auto;
	}

	.bv-board {
		min-width: 460px;
	}
}

@supports (max-height: 92dvh) {
	@media (max-width: 700px) {
		.bv-modal__panel {
			max-height: 92dvh;
		}
	}
}

@media (max-width: 420px) {
	.bv-head__title {
		font-size: 1.18rem;
	}

	.bv-summary__row {
		flex-direction: column;
		gap: 2px;
	}

	.bv-sops__item summary {
		flex-direction: column;
		gap: 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bv-app * {
		transition: none !important;
	}
}
