:root {
	--header-font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--body-font-family: apple-system-ui-serif, ui-serif, Georgia, serif;
	/* Occasional Prayers theme: */
	--body-background-color: #f4f2f0; /* ivory */
	--body-color: #565656; /* neutral gray */
	--rubric-color: #76323f; /* wine red */
	--header-background-color: #d7cec7; /* greige */
	--line-color: #d7cec7; /* greige */
	--body-font-size: 13pt;
}

@media print {
	:root {
		/* Altar Book theme: */
		--body-background-color: #fff;
		--body-color: #000; /* black */
		--rubric-color: #c62f7c; /* magenta-rose */
		--body-font-size: 11pt;
	}
	@page {
		margin: 1in;
	}
	html, body, #inner-body {
		zoom: 100% !important;
		width: auto !important;
    	height: auto !important;
    	margin: 0 !important;
    	padding: 0 !important;
    	overflow: visible !important;
    	background: transparent !important;
	}
	header, footer {
		display: none;
	}
	main {
		width: auto !important;
    	max-width: none !important;
    	margin: 0 !important;
    	padding: 0 !important;
	}
	h1, h2, h3 {
		break-after: avoid-page;
	}
	img, table, blockquote, pre, code, p {
		break-inside: avoid;
	}
}

html {
	margin: 0;
	padding: 0;
}
body {
	background-color: var(--header-background-color);
	color: var(--body-color);
	font-size: var(--body-font-size);
	margin: 0;
	padding: 0;
	font-family: var(--body-font-family);
}
div#inner-body {
	background-color: var(--body-background-color);
	margin: 0;
	padding: 0;
	min-height: 100vh;
}

header {
	width: 100%;
	margin: 0;
	background-color: var(--header-background-color);
	font-family: var(--header-font-family);

	/* Fixed navbar code */
	position: fixed;
	z-index: 1000;
	top: -100px;
	padding: 120px 0 20px 0;

	div.inner {
		max-width: 820px;
		margin: 0 auto;
		padding: 0 20px;
		display: flex;
		flex-wrap: nowrap;
		justify-content: space-between;
		align-items: center;
		align-content: center;
		gap: 12px;
	}
	h1 {
		font-size: 1em;
		font-weight: 600;
		margin: 0;
		padding: 0;
		display: inline;
		text-transform: uppercase;
		white-space: nowrap;
	}
	h2 {
		font-size: 1em;
		font-weight: 400;
		margin: 0;
		padding: 0;
		display: inline;
		text-transform: uppercase;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		flex-grow: 3;
	}
	a, a:visited, a:active {
		color: var(--rubric-color);
		text-decoration: none;
	}
	.account-link,
	.user-toggle {
		font-size: 0.9em;
		border: 1px solid rgba(27, 27, 27, 0.2);
		padding: 0.35em 0.65em;
		border-radius: 5px;
		background: rgba(255, 255, 255, 0.5);
		display: inline-flex;
		align-items: center;
		gap: 0.4em;
	}
	.user-menu {
		position: relative;
	}
	.user-toggle {
		cursor: pointer;
		max-width: 10em;
	}
	.user-name {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		max-width: calc(10em - 1.4em);
	}
	.user-caret {
		font-size: 0.8em;
	}
	.user-dropdown {
		position: absolute;
		right: 0;
		top: 100%;
		margin-top: 0;
		background: #fff;
		border: 1px solid rgba(27, 27, 27, 0.2);
		border-radius: 5px;
		padding: 0.4em;
		min-width: 140px;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
		opacity: 0;
		pointer-events: none;
		transform: translateY(-4px);
		transition: opacity 0.2s ease, transform 0.2s ease;
	}
	.user-dropdown::before {
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		top: -8px;
		height: 8px;
	}
	.user-menu:focus-within .user-dropdown,
	.user-menu:hover .user-dropdown {
		opacity: 1 !important;
		pointer-events: auto !important;
		transform: translateY(0) !important;
	}
	.user-dropdown a {
		display: block;
		padding: 0.3em 0.4em;
		font-size: 0.85em;
		color: var(--rubric-color);
	}
	.user-dropdown a:visited,
	.user-dropdown a:active,
	.user-dropdown a:focus {
		color: var(--rubric-color);
	}
	.user-dropdown a:hover {
		color: var(--body-color);
	}
}

main {
	max-width: 820px;
	margin: 0 auto;
	/* padding: 20px; */

	/* Fixed navbar code */
	padding: 80px 20px 20px 20px;
}

footer {
	max-width: 820px;
	margin: 0 auto;
	padding: 0 0 20px 0;
	font-family: var(--header-font-family);
	font-size:  0.8em;
	text-align: center;

	a, a:visited, a:active {
		color: var(--body-color);
	}
	.coda {
		width: 64px;
		height: 64px;
	}
}

input[type="text"], input[type="date"], select {
	background: #f6f6f6;
	border: 1px solid var(--line-color);
	border-radius: 5px;
	color: #555 !important;
	font-family: var(--header-font-family);
	font-size: 0.9em;
	padding: 0.3em;
}
.button {
  display: inline-block;
  text-decoration: none;
}
button, input[type="submit"], .button, .button:visited {
	background: #f6f6f6;
	border: 1px solid var(--line-color);
	border-radius: 5px;
	color: #555 !important;
	cursor: pointer;
	font-family: var(--header-font-family);
	font-size: 0.9em;
	padding: 0.6em 1.2em;
}
button:hover, input[type="submit"]:hover, .button:hover {
	background-color: #fff;
	color: var(--body-color);
}

div#page {
	h2 {
		font-size: 1.2em;
		font-weight: 600;
		margin: 20px 0;
	}
	h3 {
		font-size: 0.91em;
		font-weight: 400;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--rubric-color);
		margin: 1em 0;
	}
	.plan-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1em;
		flex-wrap: wrap;
	}
	.plan-header-actions {
		display: flex;
		gap: 0.75em;
		align-items: center;
	}
	.plan-header-actions form {
		margin: 0;
	}
	.plan-footer-actions {
		display: flex;
		gap: 0.75em;
		align-items: center;
		flex-wrap: wrap;
		margin-top: 1.5em;
		justify-content: flex-end;
	}
	.plan-footer-actions form {
		margin: 0;
	}
	p {
		line-height: 1.5;
		margin: 1em 0;
	}
	a {
		color: var(--rubric-color);
	}
	a:visited {
		color: #6c2d3c;
	}
	ul {
		margin: 1em 0;
	}
	li {
		line-height: 1.2;
		padding-bottom: 0.3em;
	}
	.plan-list {
		list-style: none;
		margin: 1em 0;
		padding: 0;
	}
	.plan-row {
		background: #f6f6f6;
		color: #555;
		font-family: var(--header-font-family);
		font-size: 0.9em;
		border: 1px solid var(--line-color);
		margin: 0;
		padding: 0.75em 1em;
		position: relative;
	}
	.plan-row-main {
		padding: 0 2.5em 0 2.4em;
	}
	.plan-row + .plan-row {
		border-top: 0;
	}
	.plan-row:first-child {
		border-top-left-radius: 5px;
		border-top-right-radius: 5px;
	}
	.plan-row:last-child {
		border-bottom-left-radius: 5px;
		border-bottom-right-radius: 5px;
	}
	.plan-row:hover {
		background-color: #fff;
		color: var(--body-color);
	}
	.plan-row.is-dragging {
		background-color: #fff;
		color: var(--body-color);
		opacity: 0.6;
	}
	.plan-item {
		display: block;
	}
	.plan-item input {
		appearance: none;
		background: #fff;
		border: 2px solid var(--line-color);
		border-radius: 5px;
		height: 1.5em;
		left: 1.5em;
		margin: 0;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 1.5em;
	}
	.plan-item input:checked {
		background: var(--rubric-color);
		border-color: var(--rubric-color);
	}
	.plan-item input:checked::after {
		border: solid #fff;
		border-width: 0 2px 2px 0;
		content: '';
		height: 0.55em;
		left: 50%;
		position: absolute;
		top: 45%;
		transform: translate(-50%, -50%) rotate(45deg);
		width: 0.3em;
	}
	.plan-actions {
		margin: 0.8em 0 0 0;
	}
	.plan-inline-fields {
		display: flex;
		gap: 1em;
		flex-wrap: wrap;
		align-items: flex-start;
	}
	.plan-inline-fields > * {
		flex: 1 1 300px;
		margin: 0;
	}
	.plan-field {
		display: flex;
		flex-direction: column;
		gap: 0.35em;
	}
	.plan-field span {
		font-size: 0.8em;
		text-transform: uppercase;
		letter-spacing: 0.08em;
		color: var(--rubric-color);
	}
	.plan-field input {
		padding: 0.6em 0.75em;
		border-radius: 0.5em;
		border: 1px solid rgba(27, 27, 27, 0.2);
		background: #fff;
		font-size: 0.95em;
	}
	.plan-field-value {
		font-size: 0.95em;
		font-weight: 600;
		color: var(--body-color);
	}
	.plan-error {
		border: 1px solid rgba(124, 30, 26, 0.4);
		background: rgba(124, 30, 26, 0.08);
		color: #7c1e1a;
		padding: 0.6em 0.8em;
		border-radius: 5px;
		margin: 0.8em 0 1em 0;
	}
	.auth-form {
		margin-top: 1em;
	}
	.auth-actions {
		display: flex;
		justify-content: flex-start;
		margin-top: 0.5em;
	}
	.auth-toggle {
		display: inline-flex;
		align-items: center;
		gap: 0.4em;
		font-size: 0.9em;
		color: var(--body-color);
		margin-top: 0;
	}
	.auth-toggle-row {
		margin-top: -0.5em;
	}
	.auth-alt {
		margin-top: 1em;
		font-size: 0.95em;
	}
	.plan-title {
		font-weight: 600;
		cursor: pointer;
	}
	.plan-handle {
		color: var(--rubric-color);
		font-size: 1.2em;
		cursor: grab;
		user-select: none;
		position: absolute;
		padding: 0.5em;
		margin: 0 -0.5em;
		right: 1em;
		top: 50%;
		transform: translateY(-50%);
	}
	.plan-row small {
		display: block;
	}
}

div#text {
	h1 {
		font-size: 1.36em;
		font-weight: 200;
		text-align: center;
		text-transform: uppercase;
		letter-spacing: 0.2em;
		line-height: 1.67em;
		margin: 0.67em 0;

		small {
			font-size: 0.8em;
			letter-spacing: 0.1em;
			color: var(--rubric-color);

			em {
				font-size: 0.67em;
				text-transform: none;
			}
		}
	}
	h2 {
		font-size: 1.1em;
		font-weight: 400;
		font-style: italic;
		text-align: center;
		color: var(--rubric-color);
		margin: 0.83em 0;
	}
	h3 {
		font-size: 0.91em;
		font-weight: 400;
		letter-spacing: 0.1em;
		text-align: center;
		text-transform: uppercase;
		color: var(--rubric-color);
		margin: 1em 0;
	}
	h6 {
		font-size: 0.82em;
		font-weight: 400;
		text-align: right;
		text-transform: uppercase;
		color: var(--rubric-color);
		margin: -1.11em 0 1.11em 0;
	}
	strong {
		font-weight: 600;
	}
	em:not(:where(h1, h2, h3, h4, h5, h6) em) {
		/* Rubrics */
		font-style: italic;
		color: var(--rubric-color);
	}
	small {
		font-size: 0.81em;
	}
	p {
		/* line-height: 1.5; */
		margin: 0.91em 0;
		text-wrap: pretty;
	}
	pre {
		margin: 0 auto;
	}
	code {
		color: var(--body-color);
		font-size: 1em;
		font-family: var(--body-font-family);
		font-weight: 600;
		white-space-collapse: preserve;
		text-wrap-mode: nowrap;
	}
	ul {
		margin: 0;
		padding: 0;
		list-style: none;
	}
	ul li {
		display: inline-block;
		box-sizing: border-box;
	} 
	ul li + li {
		margin-left: 1em;
		padding-left: 1em;
		border-left: 1px solid var(--line-color);
	}
	p:has(> em:first-child):has(:not(em)) {
		> em {
			display: inline-block;
			margin-right: 0.5em;
			min-width: 4.5em;
			font-size: 0.91em;
			text-align: right;
		}
		.trailing-indent {
			/* Distasteful hack */
			display: inline-block;
			width: calc(100% - 5em);
			vertical-align: top;
		}
	}
}
