/*
 * Postful default styles. Optional (Postful → Settings).
 * Uses the theme's font and colours unless the content type's Style panel
 * sets them (as --pf-* custom properties on the wrapper). Scoped and kept
 * low-specificity so the theme's own rules win.
 */

.postful [hidden] { display: none !important; }

.postful,
.postful-layout {
	--pf-rule: var(--pf-index-line, rgba(127, 127, 127, .22));
	--pf-radius: 10px;
	color: var(--pf-text, inherit);
	font-size: var(--pf-text-size, inherit);
}
/* Links use the theme's link colour unless a colour is chosen in the Style step. */
[data-pf-colors~="pf-has-accent"] .postful a,
.postful[data-pf-colors~="pf-has-accent"] a { color: var(--pf-accent); }

/* ---- Layout ------------------------------------------------------------
 * [postful] fills whatever container it is placed in (no wide/full breakout).
 * Two rows so the title row and Previous / Today / Next share one line:
 *   [ title · date ][ links      ]
 *   [ devotional   ][ month list ]
 */

.postful-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--pf-aside-width, 280px);
	grid-template-areas: "head nav" "body index";
	column-gap: var(--pf-gap, 48px);
	row-gap: 1.4em;
	align-items: start;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--pf-width, 100%);
	/* No outer spacing: space above and below comes from the container. */
	margin: 0;
	padding: 0;
}
.postful-wrap,
.postful-layout .postful,
.postful-layout .pf-entry { margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.postful-layout .pf-area-head { grid-area: head; align-self: center; min-width: 0; }
.postful-layout .pf-area-nav { grid-area: nav; align-self: center; }
.postful-layout .pf-area-body { grid-area: body; min-width: 0; }
.postful-layout .pf-area-index { grid-area: index; }
.postful-layout .pf-area-head .pf-entry-head { margin: 0; }

/* Stack when the container (not the screen) is narrow: title, devotional, links, month list. */
.postful-wrap { container-type: inline-size; width: 100%; }
@container (max-width: 680px) {
	.postful-layout {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "head" "body" "nav" "index";
	}
}

/* ---- Entry -------------------------------------------------------------- */

.pf-current { transition: opacity .2s ease; }
.pf-current.is-loading { opacity: .45; }

/* Title on the left, the day on the right, centred on one line (wraps on narrow screens). */
.pf-entry .pf-entry-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .2em 1.5em;
	margin: 0 0 1.2em;
}
.pf-entry .pf-entry-title {
	flex: 1 1 0;
	min-width: 10em;
	margin: 0;
	font-size: clamp(1.6em, 3.4vw, 2.1em);
	font-weight: 600;
	line-height: 1.2;
}
/* The day: small, spaced capitals, muted. */
.pf-entry .pf-date {
	margin: 0 0 var(--pf-date-space, 0);
	white-space: nowrap;
	color: var(--pf-date-color, inherit);
	font-size: var(--pf-date-size, .8em);
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: var(--pf-date-case, uppercase);
	opacity: .6;
}

/* Fields: neutral by default; each field's look comes from the Style step. */
.pf-entry .pf-field { margin: 0 0 1.1em; }
.pf-entry .pf-field:last-child { margin-bottom: 0; }
.pf-entry .pf-field p { margin: 0 0 1em; }
.pf-entry .pf-field p:last-child { margin-bottom: 0; }
.pf-entry .pf-field--richtext,
.pf-entry .pf-field--textarea { line-height: 1.7; }
.pf-entry .pf-field img { max-width: 100%; height: auto; border-radius: var(--pf-radius); }

.postful .pf-message { margin: 0; font-style: italic; opacity: .7; }

/* ---- Previous / Today / Next: real links in the theme's link colour ---- */

.postful.pf-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: var(--pf-nav-align, center);
	gap: .4em 1.8em;
}
.postful.pf-nav .pf-nav-btn {
	font-size: var(--pf-nav-size, 1em);
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
}
.postful.pf-nav .pf-nav-btn:hover,
.postful.pf-nav .pf-nav-btn:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.postful.pf-nav .pf-nav-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
[data-pf-colors~="pf-has-nav-color"] .pf-nav .pf-nav-btn,
.pf-nav[data-pf-colors~="pf-has-nav-color"] .pf-nav-btn { color: var(--pf-nav-color); }

/* ---- Month list: flush rows, colour for focus (no boxes, no padding) --- */

.pf-index .pf-index-title { margin: 0 0 .6em; font-size: var(--pf-month-size, 1em); font-weight: 600; }
.pf-index .pf-month { border-top: 1px solid var(--pf-rule); }
.pf-index .pf-month:last-of-type { border-bottom: 1px solid var(--pf-rule); }
.pf-index summary {
	display: flex;
	align-items: baseline;
	gap: .8em;
	padding: .6em 0;
	font-size: var(--pf-month-size, 1em);
	font-weight: 500;
	cursor: pointer;
	list-style: none;
	transition: color .15s;
}
.pf-index summary::-webkit-details-marker { display: none; }
.pf-index details[open] > summary { font-weight: 600; }
[data-pf-colors~="pf-has-accent"] .pf-index details[open] > summary,
.pf-index[data-pf-colors~="pf-has-accent"] details[open] > summary { color: var(--pf-accent); }
.pf-index summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.pf-index .pf-month-name { flex: 1; text-transform: capitalize; }
.pf-index .pf-month-count { font-size: .8em; font-weight: 400; opacity: .5; font-variant-numeric: tabular-nums; }

.pf-index .pf-days { margin: 0 0 .6em; padding: 0; list-style: none; }
.pf-index .pf-days li { margin: 0; padding: 0; }
.pf-index .pf-day {
	box-sizing: border-box;
	display: flex;
	align-items: baseline;
	gap: .8em;
	width: 100%;
	margin: 0;
	padding: .3em 0;
	border: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	font-size: var(--pf-day-size, .95em);
	text-decoration: none;
	line-height: 1.45;
	text-align: left;
	opacity: .78;
	cursor: pointer;
	transition: color .15s, opacity .15s;
}
.pf-index .pf-day:not(.is-current) { color: inherit; } /* other days in the text colour */
.pf-index .pf-day:hover { background: none; opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.pf-index .pf-day:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.pf-index .pf-day.is-current { font-weight: 600; opacity: 1; } /* the theme's link colour */
[data-pf-colors~="pf-has-accent"] .pf-index .pf-day.is-current,
.pf-index[data-pf-colors~="pf-has-accent"] .pf-day.is-current { color: var(--pf-accent); }
.pf-index .pf-day-num { min-width: 2ch; font-variant-numeric: tabular-nums; text-align: right; opacity: .6; }
.pf-index .pf-day.is-current .pf-day-num { opacity: 1; }
.pf-index .pf-day-label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.pf-index .pf-day-text { flex: 1; }

.postful-notice { padding: .8em 1em; border: 1px dashed currentColor; opacity: .8; font-size: .9em; }

@media (prefers-reduced-motion: reduce) {
	.pf-current, .postful.pf-nav .pf-nav-btn { transition: none; }
}

/* [sp_index] places the links right above the month list. */
.postful.pf-nav + .postful.pf-index { margin-top: 1.4em; }
