/* Optional full-width breakout (Settings > NA Events Calendar > Calendar Width).
   Breaks the calendar out of whatever narrower content column the theme
   places it in, re-centers it on the viewport, and caps it at
   --naec-max-width (set inline per-instance from the admin setting).
   Uses a compound selector (.naec-calendar-wrap.naec-breakout) so this
   reliably wins over the base .naec-calendar-wrap width rule above,
   regardless of CSS source order. */
.naec-calendar-wrap.naec-breakout {
	width: 100vw !important;
	max-width: 100vw !important;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
}

.naec-breakout-inner {
	max-width: var(--naec-max-width, 1200px);
	margin: 0 auto;
	padding: 0 1em;
	box-sizing: border-box;
}

@media (max-width: 600px) {
	.naec-breakout-inner {
		padding: 0 0.5em;
	}
}

.naec-calendar-wrap {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 0 2em;
	font-family: inherit;
	box-sizing: border-box !important;
	overflow-x: hidden !important; /* never let the calendar push the page wider */
}

.naec-calendar-wrap *,
.naec-calendar-wrap *::before,
.naec-calendar-wrap *::after {
	box-sizing: border-box !important;
}

.naec-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.25em;
	gap: 0.5em;
}

.naec-month-title {
	margin: 0;
	font-size: 1.4em;
	text-align: center;
	flex: 1;
	min-width: 0;
}

.naec-nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25em;
	height: 2.25em;
	text-decoration: none;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
	font-size: 1.1em;
	color: #333;
	background: #f6f7f7;
}

.naec-nav:hover {
	background: #eee;
}

.naec-today-link {
	text-align: center;
	margin-bottom: 0.5em;
	font-size: 0.9em;
}

.naec-notice {
	padding: 1em;
	background: #fff8e5;
	border: 1px solid #e0c68a;
	border-radius: 4px;
}

/* View toggle (Grid / List) */
.naec-view-toggle {
	display: flex;
	justify-content: center;
	gap: 0.4em;
	margin-bottom: 0.85em;
}

.naec-view-btn {
	background: #f6f7f7;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
	padding: 0.4em 1.1em;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	color: #333;
}

.naec-view-btn:hover {
	background: #eee;
}

.naec-view-btn-active {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.naec-view[hidden] {
	display: none;
}

/* Grid view — a true CSS grid, capped at the container width */
.naec-weekday-row,
.naec-grid {
	display: grid !important;
	grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
	width: 100% !important;
	max-width: 100% !important;
}

.naec-weekday-row {
	gap: 4px;
	margin-bottom: 4px;
}

.naec-weekday {
	min-width: 0;
	text-align: center;
	font-weight: 600;
	font-size: 0.78em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #555;
	padding: 4px 2px;
	overflow-wrap: break-word;
}

.naec-grid {
	gap: 4px;
	grid-auto-rows: 200px !important; /* fixed — every cell is identical; busy days use the day-summary popup instead of growing */
}

.naec-day {
	min-width: 0 !important; /* critical: stops long unbreakable content from blowing out the column width */
	max-width: 100%;
	background: #fff;
	border: 1px solid #e2e4e7;
	border-radius: 4px;
	padding: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.naec-day-outside {
	background: #fafafa;
}

.naec-day-outside .naec-day-header {
	opacity: 0.55;
}

.naec-day-today {
	border-color: #2271b1;
	box-shadow: inset 0 0 0 1px #2271b1;
}

/* Full-width header box containing just the day number. Black + white when
   the day has events (and clickable — opens the day's full event list);
   light grey and non-interactive when the day has none. */
.naec-day-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	border: none;
	border-radius: 0;
	padding: 6px 4px;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 700;
	line-height: 1;
	background: #1d2327;
	color: #fff;
	cursor: pointer;
}

.naec-day-header:hover {
	background: #000;
}

.naec-day-header-empty {
	background: #e2e4e7;
	color: #8a8f98;
	cursor: default;
}

.naec-day-body {
	flex: 1;
	min-height: 0;
	padding: 4px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.naec-day-events {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.naec-event {
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	text-align: left;
	background: #e7f1fb;
	border: none;
	border-left: 3px solid #2271b1;
	border-radius: 2px;
	padding: 2px 4px;
	font-size: 0.75em;
	line-height: 1.3;
	cursor: pointer;
	color: #1d2327;
	text-wrap: pretty;                   /* nicer line-break choices in browsers that support it; ignored elsewhere */
	white-space: normal !important;      /* allow titles to wrap instead of forcing the grid wider */
	overflow-wrap: break-word !important;
	word-break: normal !important;       /* let hyphens (below) find a sensible break point instead of chopping off a single trailing letter */
	hyphens: auto !important;
	-webkit-hyphens: auto !important;
	-ms-hyphens: auto !important;
}

.naec-event:hover {
	background: #d3e6f8;
}

.naec-see-more {
	display: block;
	width: 100%;
	background: none;
	border: none;
	text-align: left;
	color: #2271b1;
	font-size: 0.72em;
	font-weight: 600;
	padding: 2px 4px;
	cursor: pointer;
}

.naec-see-more:hover {
	text-decoration: underline;
}

.naec-event-hidden {
	display: none;
}

/* List view */
.naec-list {
	width: 100%;
}

.naec-list-day {
	border-bottom: 1px solid #e2e4e7;
	padding: 0.75em 0;
}

.naec-list-day:first-child {
	padding-top: 0;
}

.naec-list-day-today .naec-list-date {
	color: #2271b1;
}

.naec-list-date {
	margin: 0 0 0.5em;
	font-size: 0.95em;
}

.naec-list-events {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
}

.naec-list-event {
	font-size: 0.85em !important;
	padding: 0.5em 0.6em !important;
}

.naec-list-empty {
	padding: 1em 0;
	color: #666;
}

/* Modal */
.naec-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 1em;
}

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

.naec-modal {
	background: #fff;
	border-radius: 6px;
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	padding: 1.75em;
	position: relative;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.naec-modal-close {
	position: absolute;
	top: 0.5em;
	right: 0.75em;
	background: none;
	border: none;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	color: #555;
}

.naec-modal-close:hover {
	color: #000;
}

.naec-modal-back {
	background: none;
	border: none;
	color: #2271b1;
	font-weight: 600;
	font-size: 0.9em;
	cursor: pointer;
	padding: 0;
	margin-bottom: 0.75em;
}

.naec-modal-back:hover {
	text-decoration: underline;
}

.naec-day-modal-events {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
}

.naec-day-modal-event {
	display: flex !important;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15em;
	font-size: 0.9em !important;
	padding: 0.6em 0.75em !important;
	line-height: 1.35 !important;
}

.naec-day-modal-event-title {
	font-weight: 600;
	color: #1d2327;
}

.naec-day-modal-event-when {
	font-size: 0.85em;
	color: #2271b1;
	font-weight: 400;
}

.naec-modal-title {
	margin: 0 1.5em 0.25em 0;
	font-size: 1.25em;
	overflow-wrap: break-word;
}

.naec-modal-when {
	margin: 0 0 1em;
	font-weight: 600;
	color: #2271b1;
}

.naec-modal-description {
	margin-bottom: 1em;
	line-height: 1.5;
	overflow-wrap: break-word;
}

.naec-modal-description p:first-child {
	margin-top: 0;
}

.naec-modal-location {
	margin-bottom: 1em;
	overflow-wrap: break-word;
}

.naec-modal-attachments ul {
	margin: 0.4em 0 0;
	padding-left: 1.2em;
}

.naec-modal-attachments li {
	overflow-wrap: break-word;
}

@media (max-width: 600px) {
	.naec-grid {
		gap: 2px;
		grid-auto-rows: 150px;
	}
	.naec-weekday-row {
		gap: 2px;
	}
	.naec-day-header {
		font-size: 0.85em;
		padding: 4px 2px;
	}
	.naec-day-body {
		padding: 2px;
	}
	.naec-event {
		font-size: 0.62em;
		padding: 1px 2px;
	}
	.naec-see-more {
		font-size: 0.6em;
		padding: 1px 2px;
	}
	.naec-month-title {
		font-size: 1.1em;
	}
	.naec-weekday {
		font-size: 0.65em;
		padding: 3px 1px;
	}
}
