/*
 * FST Birthday Freebies: the visitor page.
 * Layout and spacing only. Fonts and colors are inherited from the theme; borders and
 * fills are neutral grays at partial opacity so they work on light and dark themes.
 */

.fst-bday-page {
	margin: 1.5em 0;
}

/* Filters */

.fst-bday-filters {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 0.75em 1.25em;
	align-items: start;
	margin: 0 0 1.5em;
	padding: 1em;
	border: 1px solid rgba(127, 127, 127, 0.4);
	border-radius: 0.5em;
}

.fst-bday-field {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.fst-bday-field label,
.fst-bday-field legend {
	display: block;
	margin: 0 0 0.25em;
	padding: 0;
	font-weight: 600;
}

.fst-bday-field .fst-bday-check {
	margin: 0 0 0.25em;
	font-weight: normal;
}

.fst-bday-filters input[type="search"],
.fst-bday-filters select {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0 0 0.25em;
	font: inherit;
}

/* The form is rendered with the hidden attribute and the page script shows it, so display:grid must not win over it. */
.fst-bday-filters[hidden] {
	display: none;
}

/* The birthday pickers sit side by side. */
.fst-bday-filters .fst-bday-birthday {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 0.75em;
}

.fst-bday-filters .fst-bday-birthday legend {
	grid-column: 1 / -1;
}

/* Without JavaScript the controls do nothing, so do not show them. */
@media (scripting: none) {
	.fst-bday-filters {
		display: none;
	}
}

/* Helpers: the count line, buttons, text for screen readers only, and the report honeypot */

.fst-bday-count {
	margin: 0 0 1em;
}

.fst-bday-count:empty {
	display: none;
}

.fst-bday-sr,
.fst-bday-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.fst-bday-page .fst-bday-btn {
	box-sizing: border-box;
	margin: 0;
	padding: 0.35em 0.8em;
	border: 1px solid rgba(127, 127, 127, 0.7);
	border-radius: 0.35em;
	font: inherit;
	line-height: 1.3;
	cursor: pointer;
}

/* Quiet outline buttons in the theme's own text color. The :not() pairs raise the specificity above themes
   that fill every button (Twenty Twenty-One does, with button:not(:hover):not(:active)). */
.fst-bday-page button.fst-bday-btn:not(:hover):not(:active) {
	background: transparent;
	color: inherit;
}

.fst-bday-page button.fst-bday-btn:hover,
.fst-bday-page button.fst-bday-btn:active {
	border-color: rgba(127, 127, 127, 0.7);
	background: rgba(127, 127, 127, 0.15);
	color: inherit;
}

.fst-bday-page .fst-bday-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.fst-bday-page .fst-bday-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

@media (pointer: coarse) {
	.fst-bday-page .fst-bday-btn {
		min-height: 2.75em;
	}
}

/* Plan and report dialog (filled in by the page script) */

.fst-bday-plan {
	margin: 0 0 1.5em;
	padding: 1em;
	border: 1px solid rgba(127, 127, 127, 0.4);
	border-radius: 0.5em;
}

.fst-bday-plan:empty {
	display: none;
}

.fst-bday-plan .fst-bday-plan-title {
	margin: 0 0 0.25em;
	font-size: 1.25em;
}

.fst-bday-plan .fst-bday-plan-intro {
	margin: 0 0 0.75em;
	opacity: 0.85;
}

.fst-bday-plan-list {
	margin: 0 0 1em;
	padding: 0;
	list-style: none;
}

.fst-bday-plan-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"brand tick"
		"deal tick"
		"when tick"
		"links links";
	gap: 0.15em 1em;
	align-items: center;
	margin: 0;
	padding: 0.6em 0 0.6em 0.6em;
	border-top: 1px solid rgba(127, 127, 127, 0.3);
	border-left: 0.25em solid transparent;
	overflow-wrap: anywhere;
}

.fst-bday-plan-item .fst-bday-plan-brand {
	grid-area: brand;
	font-weight: 600;
}

.fst-bday-plan-item .fst-bday-plan-deal {
	grid-area: deal;
}

.fst-bday-plan-item .fst-bday-plan-when {
	grid-area: when;
	opacity: 0.85;
}

.fst-bday-plan-item .fst-bday-plan-tick {
	grid-area: tick;
	margin: 0;
	white-space: nowrap;
}

.fst-bday-plan-item .fst-bday-plan-links {
	grid-area: links;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	margin-top: 0.25em;
}

@media (max-width: 479px) {
	/* On a phone the tick gets its own line, so the brand and the date keep the full width. */
	.fst-bday-plan-item {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"brand"
			"deal"
			"when"
			"tick"
			"links";
	}
}

.fst-bday-plan-item.fst-bday-missed {
	border-left-color: #d9822b;
}

.fst-bday-plan-item.fst-bday-missed .fst-bday-plan-when {
	font-weight: 600;
	opacity: 1;
}

.fst-bday-plan-item.fst-bday-done .fst-bday-plan-brand {
	text-decoration: line-through;
	opacity: 0.7;
}

.fst-bday-plan .fst-bday-plan-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 0.75em;
	margin: 0;
}

/* Sharing: the page's Share button, and the panel that opens under a Share button on computers */

.fst-bday-share-page {
	margin: 0 0 1em;
}

.fst-bday-share-panel {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
	margin: 0.5em 0 0;
	padding: 0.75em;
	border: 1px solid rgba(127, 127, 127, 0.4);
	border-radius: 0.5em;
}

/* The site links look like the panel's buttons. */
.fst-bday-page a.fst-bday-btn {
	display: inline-flex;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

.fst-bday-page a.fst-bday-btn:hover {
	background: rgba(127, 127, 127, 0.15);
}

.fst-bday-share-panel .fst-bday-share-status {
	flex-basis: 100%;
	margin: 0;
}

.fst-bday-share-panel .fst-bday-share-status:empty {
	display: none;
}

.fst-bday-share-field {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.25em;
	font: inherit;
}

/* The report dialog */

.fst-bday-report {
	box-sizing: border-box;
	width: min(32rem, 92vw);
	max-height: 92vh;
	padding: 1em;
	border: 1px solid rgba(127, 127, 127, 0.6);
	border-radius: 0.5em;
}

.fst-bday-report::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.fst-bday-report .fst-bday-report-title {
	margin: 0 0 0.25em;
	font-size: 1.25em;
}

.fst-bday-report .fst-bday-report-for {
	margin: 0 0 0.75em;
	font-weight: 600;
}

.fst-bday-report .fst-bday-field {
	margin: 0 0 0.75em;
}

.fst-bday-report textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	font: inherit;
}

.fst-bday-report .fst-bday-report-status {
	min-height: 1.5em;
	margin: 0 0 0.5em;
}

.fst-bday-report .fst-bday-report-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 0.75em;
	margin: 0;
}

/* Cards */

.fst-bday-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
	gap: 1em;
}

@media (max-width: 639px) {
	.fst-bday-list {
		grid-template-columns: 1fr;
	}
}

.fst-bday-card {
	box-sizing: border-box;
	min-width: 0;
	padding: 1em;
	border: 1px solid rgba(127, 127, 127, 0.4);
	border-radius: 0.5em;
	overflow-wrap: anywhere;
}

/* A deal link's card: clear of a fixed menu bar, and outlined for a few seconds. */
.fst-bday-card {
	scroll-margin-top: 4rem;
	outline: 3px solid transparent;
	outline-offset: 2px;
	transition: outline-color 1s;
}

.fst-bday-card.fst-bday-card-shared {
	outline-color: var(--fst-green, #8fc33a);
}

@media (prefers-reduced-motion: reduce) {
	.fst-bday-card {
		transition: none;
	}
}

.fst-bday-deal-note {
	margin: 0 0 0.5em;
}

.fst-bday-card .fst-bday-brand {
	margin: 0 0 0.25em;
	font-size: 1.15em;
	line-height: 1.25;
}

.fst-bday-card .fst-bday-freebie {
	margin: 0 0 0.5em;
	font-weight: 600;
}

.fst-bday-card .fst-bday-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	margin: 0 0 0.5em;
	padding: 0;
	list-style: none;
}

.fst-bday-card .fst-bday-badge {
	margin: 0;
	padding: 0.1em 0.65em;
	border-radius: 999px;
	background: rgba(127, 127, 127, 0.2);
	font-size: 0.8em;
	line-height: 1.5;
}

.fst-bday-card .fst-bday-details,
.fst-bday-card .fst-bday-meta,
.fst-bday-card .fst-bday-links {
	margin: 0 0 0.5em;
}

.fst-bday-card .fst-bday-meta {
	font-size: 0.9em;
	opacity: 0.8;
}

.fst-bday-card .fst-bday-meta span + span::before {
	content: "\00b7";
	margin: 0 0.5em;
}

.fst-bday-card .fst-bday-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1em;
	margin-bottom: 0;
}

.fst-bday-card .fst-bday-signup {
	font-weight: 600;
}

.fst-bday-card[hidden] {
	display: none;
}

.fst-bday-card .fst-bday-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	margin: 0.75em 0 0;
	font-size: 0.9em;
}

/* "Report a problem" is rare, so it reads as a link rather than a button. */
.fst-bday-page button.fst-bday-btn.fst-bday-report-open {
	padding-right: 0;
	padding-left: 0;
	border-color: transparent;
	text-decoration: underline;
}

.fst-bday-card .fst-bday-owner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 0.75em;
	margin: 0.75em 0 0;
	padding-top: 0.5em;
	border-top: 1px dashed rgba(127, 127, 127, 0.5);
	font-size: 0.9em;
}

/* Print: the plan only. */

@media print {
	body * {
		visibility: hidden;
	}

	#fst-bday-plan,
	#fst-bday-plan * {
		visibility: visible;
	}

	/* The long parts take no room, so the printout is not padded with blank pages. */
	.fst-bday-share-page,
	.fst-bday-filters,
	.fst-bday-count,
	.fst-bday-list,
	.fst-bday-report {
		display: none;
	}

	/* The name links to the card on screen; on paper it is just the name. */
	#fst-bday-plan .fst-bday-plan-brand-link {
		color: inherit;
		text-decoration: none;
	}

	/* Buttons are for the screen; the printout is the checklist. */
	#fst-bday-plan .fst-bday-plan-actions,
	#fst-bday-plan .fst-bday-share-panel,
	#fst-bday-plan .fst-bday-plan-remove {
		display: none;
	}

	#fst-bday-plan {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		margin: 0;
		padding: 0;
		border: 0;
	}
}
