/* Parish Events frontend styles: calendar/list, featured cards, single pages. */

/* Brand color. Resolution order: the Settings accent color (inline style
   after this sheet), else a tiny script samples the theme's link color at
   runtime, else this fallback. Tints and shades derive from the accent via
   color-mix; each has a static fallback for older browsers. */
:root {
	--pe-accent: #2c5f2d;
	--pe-accent-contrast: #fff;
}

/* --- Controls --- */
.pe-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.25rem;
}

.pe-view-toggle a {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	border: 1px solid #ccc;
	text-decoration: none;
	color: inherit;
}

.pe-view-toggle a:first-child {
	border-radius: 4px 0 0 4px;
}

.pe-view-toggle a:last-child {
	border-radius: 0 4px 4px 0;
	border-left: 0;
}

.pe-view-toggle a.pe-toggle-active {
	background: var(--pe-accent);
	border-color: var(--pe-accent);
	color: var(--pe-accent-contrast);
}

.pe-group-filter select {
	max-width: 100%;
}

/* --- List view --- */
.pe-date-heading {
	margin: 1.5rem 0 0.5rem;
	padding-bottom: 0.25rem;
	border-bottom: 2px solid var(--pe-accent);
}

.pe-day-list {
	list-style: none;
	margin: 0 0 0.5rem;
	padding: 0;
}

/* Two fixed columns: time | details. The title wraps inside its own column
   and the location always sits on its own muted line beneath the title, so
   every row reads the same regardless of name length. */
.pe-event-row {
	display: grid;
	grid-template-columns: 6.5em minmax(0, 1fr);
	column-gap: 1rem;
	align-items: baseline;
	padding: 0.5rem 0.25rem;
	border-bottom: 1px solid #eee;
	margin: 0;
}

.pe-event-time {
	grid-column: 1;
	grid-row: 1 / span 2;
	font-weight: 600;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.pe-event-title {
	grid-column: 2;
	grid-row: 1;
	font-weight: 600;
	text-decoration: none;
	overflow-wrap: break-word;
}

a.pe-event-title:hover {
	text-decoration: underline;
}

.pe-event-location {
	grid-column: 2;
	grid-row: 2;
	color: #666;
	font-size: 0.85em;
}

@media (max-width: 480px) {
	.pe-event-row {
		grid-template-columns: 5em minmax(0, 1fr);
		column-gap: 0.6rem;
	}
}

/* --- Month grid --- */
.pe-month-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}

.pe-month-title {
	font-size: 1.25em;
	font-weight: 700;
}

.pe-month-nav .pe-disabled {
	color: #bbb;
}

.pe-month-grid {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.pe-month-grid th {
	padding: 0.4rem 0.2rem;
	background: var(--pe-accent);
	color: var(--pe-accent-contrast);
	font-size: 0.85em;
	text-align: center;
}

.pe-month-grid td {
	vertical-align: top;
	border: 1px solid #ddd;
	padding: 0.25rem;
	height: 5.5rem;
}

.pe-day-number {
	display: block;
	font-size: 0.85em;
	font-weight: 600;
	color: #555;
	margin-bottom: 0.15rem;
}

.pe-today {
	background: #f3f9f3;
	background: color-mix(in srgb, var(--pe-accent) 7%, #fff);
}

.pe-today .pe-day-number {
	color: var(--pe-accent);
}

.pe-past .pe-day-number {
	color: #bbb;
}

.pe-past .pe-cell-events a,
.pe-past .pe-cell-events span {
	color: #999;
	background: #f2f2f2;
}

.pe-cell-events {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.78em;
	line-height: 1.3;
}

.pe-cell-events li {
	margin: 0 0 0.25rem;
}

/* Event pills: names clamp to two lines so one long title can't blow a
   week's row height out; the full name is in the title attribute. */
.pe-cell-events a,
.pe-cell-events span {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: break-word;
	text-decoration: none;
	background: #e9f1e9;
	background: color-mix(in srgb, var(--pe-accent) 13%, #fff);
	color: #1e4620;
	color: color-mix(in srgb, var(--pe-accent) 75%, #000);
	border-radius: 3px;
	padding: 0.1rem 0.3rem;
}

.pe-cell-events a:hover {
	background: #d7e6d7;
	background: color-mix(in srgb, var(--pe-accent) 24%, #fff);
	text-decoration: none;
}

.pe-empty-cell {
	background: #fafafa;
}

/* --- Featured events slider --- */
.pe-featured-slider {
	position: relative;
}

.pe-slider-track {
	display: flex;
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 0.25rem 0 0.5rem;
	scrollbar-width: none;
}

.pe-slider-track::-webkit-scrollbar {
	display: none;
}

/* Portrait cards: the image fills the card, text overlays a bottom
   gradient. --pe-visible = cards per view (the shortcode's columns). */
.pe-featured-slider .pe-card {
	position: relative;
	flex: 0 0 calc((100% - (var(--pe-visible) - 1) * 1rem) / var(--pe-visible));
	aspect-ratio: 3 / 4;
	/* On large monitors the 3:4 ratio would tower; the cap lets wide cards
	   settle toward square instead. */
	max-height: 480px;
	margin: 0;
	border-radius: 10px;
	overflow: hidden;
	background: var(--pe-accent);
	scroll-snap-align: start;
}

@media (max-width: 900px) {
	.pe-featured-slider {
		--pe-visible: 2 !important;
	}
}

@media (max-width: 560px) {
	.pe-featured-slider {
		/* A sliver of the next card signals there's more to scroll. */
		--pe-visible: 1.15 !important;
	}
}

.pe-card-link {
	position: absolute;
	inset: 0;
	display: block;
	color: #fff;
	text-decoration: none;
}

.pe-card-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s ease;
}

.pe-card-link:hover .pe-card-img {
	transform: scale(1.04);
}

.pe-card-link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 40%, rgba(8, 21, 40, 0.88) 100%);
}

.pe-card-badge {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 2;
	max-width: calc(100% - 1.5rem);
	padding: 0.22rem 0.8rem;
	border-radius: 999px;
	background: #fff;
	color: var(--pe-accent);
	font-size: 0.78em;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.pe-card-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: block;
	padding: 1rem;
}

.pe-card-title {
	display: block;
	margin: 0 0 0.35rem;
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
}

.pe-card-meta {
	display: block;
	margin: 0;
	font-size: 0.85em;
	color: #fff;
	opacity: 0.92;
}

.pe-slider-btn {
	position: absolute;
	top: 50%;
	z-index: 3;
	transform: translateY(-50%);
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--pe-accent);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pe-slider-prev {
	left: -0.6rem;
}

.pe-slider-next {
	right: -0.6rem;
}

.pe-slider-btn:disabled {
	opacity: 0;
	pointer-events: none;
}

/* Until (or without) JS the native scroll strip stands alone. */
.pe-featured-slider:not(.pe-slider-ready) .pe-slider-btn,
.pe-featured-slider:not(.pe-slider-ready) .pe-slider-dots {
	display: none;
}

.pe-slider-dots {
	display: flex;
	gap: 0.4rem;
	justify-content: center;
	margin-top: 0.5rem;
}

.pe-slider-dots:empty {
	display: none;
}

.pe-dot {
	width: 0.6rem;
	height: 0.6rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #c9d3c9;
	background: color-mix(in srgb, var(--pe-accent) 25%, #fff);
	cursor: pointer;
}

.pe-dot-active {
	background: var(--pe-accent);
}

/* --- Single event page --- */
.pe-featured-video {
	aspect-ratio: 16 / 9;
	margin: 0 0 1.5rem;
	background: #000;
	border-radius: 6px;
	overflow: hidden;
}

.pe-featured-video iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.pe-event-flyer {
	margin: 1.5rem 0;
}

.pe-event-flyer img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.pe-banner {
	margin: 0 0 1.25rem;
	padding: 0.75rem 1rem;
	font-weight: 600;
}

.pe-cancelled-banner {
	background: #fbeaea;
	border-left: 4px solid #c0392b;
	color: #7b241c;
}

.pe-removed-banner {
	background: #fdf3e0;
	border-left: 4px solid #b9770e;
	color: #7e5109;
}

.pe-event-details {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.3rem 1rem;
	margin: 0 0 1.5rem;
	padding: 1rem 1.25rem;
	background: #f7f7f7;
	border-radius: 6px;
}

.pe-event-details dt {
	font-weight: 700;
}

.pe-event-details dd {
	margin: 0;
}

.pe-empty {
	color: #666;
	font-style: italic;
}

/* --- Calendar buttons: add-to-calendar, subscribe --- */
.pe-add-to-calendar {
	margin: 0 0 1.5rem;
}

.pe-cal-btn,
.pe-subscribe {
	display: inline-block;
	padding: 0.3rem 0.85rem;
	border: 1px solid var(--pe-accent);
	border-radius: 4px;
	color: var(--pe-accent);
	text-decoration: none;
	font-size: 0.9em;
	font-weight: 600;
}

.pe-cal-btn:hover,
.pe-subscribe:hover {
	background: var(--pe-accent);
	color: var(--pe-accent-contrast);
	text-decoration: none;
}

/* Registration is the primary action: solid where the calendar buttons
   are outlined. */
.pe-register-btn {
	display: inline-block;
	padding: 0.3rem 1.1rem;
	border: 1px solid var(--pe-accent);
	border-radius: 4px;
	background: var(--pe-accent);
	color: var(--pe-accent-contrast);
	text-decoration: none;
	font-size: 0.9em;
	font-weight: 600;
}

.pe-register-btn:hover {
	background: #234b24;
	background: color-mix(in srgb, var(--pe-accent) 80%, #000);
	border-color: #234b24;
	border-color: color-mix(in srgb, var(--pe-accent) 80%, #000);
	color: var(--pe-accent-contrast);
	text-decoration: none;
}

/* --- Upcoming events (widget / shortcode) --- */
.pe-upcoming {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pe-upcoming li {
	padding: 0.35rem 0;
	border-bottom: 1px solid #eee;
}

.pe-upcoming li:last-child {
	border-bottom: 0;
}

.pe-upcoming-when {
	display: block;
	font-size: 0.82em;
	color: #666;
}

.pe-upcoming a {
	font-weight: 600;
	text-decoration: none;
}

.pe-upcoming a:hover {
	text-decoration: underline;
}

.pe-upcoming-loc {
	font-size: 0.85em;
	color: #666;
}

/* --- Location directory disclosure --- */
.pe-location-info {
	display: inline-block;
}

.pe-location-info summary {
	cursor: pointer;
	color: inherit;
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
}

.pe-location-info summary::after {
	content: " ⓘ";
	font-size: 0.85em;
}

.pe-location-detail {
	margin: 0.35rem 0 0.25rem;
	padding: 0.6rem 0.8rem;
	max-width: 34em;
	background: #f3f7f3;
	background: color-mix(in srgb, var(--pe-accent) 6%, #fff);
	border-left: 3px solid var(--pe-accent);
	border-radius: 0 4px 4px 0;
	font-size: 0.95em;
}

.pe-location-detail p {
	margin: 0 0 0.4rem;
}

.pe-location-detail p:last-child {
	margin-bottom: 0;
}

.pe-location-link {
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
	color: inherit;
}
