/**
 * Foundation Calendar — layout only.
 *
 * Colours, type and buttons are left to the theme wherever possible, so the
 * calendar reads as part of the site rather than as something bolted on. The
 * few colours here are structural (grid lines, the muted look of a day outside
 * the month) or carry meaning that would be lost without them (which entries
 * are classes and which are workshops).
 */

.pbp-cal {
	/* A calendar is read by scanning across a week. Past this width the day
	   tiles stretch into letterboxes and stop being scannable, so the calendar
	   is capped and centred however wide the column around it is. */
	max-width: 62rem;
	margin-inline: auto;
}

/* A class rule with a `display` beats the browser's own [hidden] rule, which
   would have left the JavaScript-only controls visible — and inert — for a
   visitor without JavaScript. Everything here that ships hidden relies on this. */
.pbp-cal [hidden] {
	display: none !important;
}

.pbp-cal-empty {
	color: #555;
	font-style: italic;
}

/* ----------------------------------------------------------------- Controls */

.pbp-cal-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.pbp-cal-filters,
.pbp-cal-views {
	display: inline-flex;
	border: 1px solid #d0d0d0;
	border-radius: 0.5rem;
	overflow: hidden;
}

.pbp-cal-filter,
.pbp-cal-view {
	background: none;
	border: 0;
	padding: 0.5rem 0.75rem;
	font: inherit;
	color: #444;
	cursor: pointer;
	min-height: 2.5rem;
}

.pbp-cal-filter:hover,
.pbp-cal-view:hover {
	background: #f3f3f3;
}

.pbp-cal-filter.is-active,
.pbp-cal-view.is-active {
	color: #fff;
	font-weight: 600;
	background: #333;
}

/* A filter wears the colour of the chips it selects, so the control and the
   grid read as one thing. "Everything" stays neutral: it stands for no one
   kind. These mirror .pbp-cal-chip--class / --workshop / --exposure below. */
.pbp-cal-filter.is-active[data-kind="class"] {
	background: #c00000;
}

.pbp-cal-filter.is-active[data-kind="workshop"] {
	background: #64748b;
}

.pbp-cal-filter.is-active[data-kind="exposure"] {
	background: #d9a520;
}

.pbp-cal-tzfield {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.pbp-cal-tzlabel {
	color: #555;
}

.pbp-cal-tz,
.pbp-cal-fmt {
	max-width: 14rem;
	padding: 0.4rem;
}

/* --------------------------------------------------------------- Month grid */

.pbp-cal-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.pbp-cal-nav__btn {
	/* 44px square: the smallest target a thumb reliably hits. */
	flex: 0 0 auto;
	width: 2.75rem;
	height: 2.75rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	line-height: 1;
	background: none;
	border: 1px solid #d0d0d0;
	border-radius: 0.5rem;
	color: #444;
	cursor: pointer;
}

.pbp-cal-nav__btn:hover {
	background: #f3f3f3;
}

.pbp-cal-nav__label {
	min-width: 0;
	text-align: center;
}

.pbp-cal-monthname {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pbp-cal-now {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 0.8rem;
	color: #c00000;
	text-decoration: underline;
	cursor: pointer;
}

/* On a narrow screen the grid scrolls inside itself rather than making the
   whole page scroll sideways. */
.pbp-cal-scroll {
	overflow-x: auto;
}

.pbp-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(5.5rem, 1fr));
	border-top: 1px solid #e2e2e2;
	border-left: 1px solid #e2e2e2;
	min-width: 38rem;
}

.pbp-cal-weekday {
	padding: 0.4rem 0.5rem;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #666;
	border-right: 1px solid #e2e2e2;
	border-bottom: 1px solid #e2e2e2;
	background: #fafafa;
}

.pbp-cal-day {
	min-height: 5.5rem;
	padding: 0.35rem;
	border-right: 1px solid #e2e2e2;
	border-bottom: 1px solid #e2e2e2;
}

.pbp-cal-day.is-outside {
	background: #fafafa;
}

.pbp-cal-day.is-outside .pbp-cal-daynum {
	color: #c4c4c4;
}

.pbp-cal-daynum {
	display: inline-block;
	font-size: 0.75rem;
	color: #666;
	margin-bottom: 0.25rem;
}

.pbp-cal-day.is-today .pbp-cal-daynum {
	background: #c00000;
	color: #fff;
	font-weight: 700;
	border-radius: 999px;
	width: 1.35rem;
	height: 1.35rem;
	line-height: 1.35rem;
	text-align: center;
}

.pbp-cal-chip {
	display: block;
	padding: 0.15rem 0.3rem;
	margin-bottom: 0.15rem;
	border: 1px solid transparent;
	border-radius: 0.25rem;
	/* A long window puts a chip on every one of its days, so the grid is dense
	   by design and the chips have to earn their space. */
	font-size: 0.56rem;
	line-height: 1.25;
	text-decoration: none;
}

.pbp-cal-chip:hover {
	filter: brightness(0.96);
}

.pbp-cal-chip .pbp-cal-time {
	display: block;
	font-weight: 700;
}

.pbp-cal-chip__title {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The one place colour carries meaning: class or workshop. */
.pbp-cal-chip--class {
	background: #fdf0f0;
	border-color: rgba(192, 0, 0, 0.3);
	color: #8a0000;
}

.pbp-cal-chip--workshop {
	background: #f1f3f6;
	border-color: #ccd3dd;
	color: #2f3a4a;
}

/* An exposure date: a window the Foundation is inviting people into. Amber so
   it is neither a class nor a workshop at a glance. */
.pbp-cal-chip--exposure {
	background: #fdf6e3;
	border-color: #e3c98b;
	color: #7a5b12;
}

.pbp-cal-entry--exposure {
	border-left-color: #d9a520;
}

.pbp-cal-open {
	display: inline-block;
	margin-left: 0.5rem;
	padding: 0.05rem 0.35rem;
	border-radius: 0.25rem;
	background: #fdf0cf;
	color: #7a5b12;
	font-size: 0.72rem;
	font-weight: 700;
}

.pbp-cal-range-sep {
	color: #666;
}

/* --------------------------------------------------------------------- List */

.pbp-cal-list {
	margin-top: 2rem;
}

.pbp-cal-list.is-primary {
	margin-top: 0;
}

.pbp-cal-list__heading {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #666;
	margin: 0 0 0.75rem;
}

.pbp-cal-entry {
	border: 1px solid #e2e2e2;
	border-left-width: 4px;
	border-radius: 0.5rem;
	padding: 1rem 1.1rem;
	margin-bottom: 0.9rem;
	scroll-margin-top: 5rem;
	transition: background-color 0.4s ease;
}

.pbp-cal-entry--class {
	border-left-color: #c00000;
}

.pbp-cal-entry--workshop {
	border-left-color: #7c8899;
}

.pbp-cal-entry.is-highlighted {
	background: #fff8e5;
}

.pbp-cal-entry__kind {
	margin: 0;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #777;
}

.pbp-cal-entry__title {
	margin: 0.15rem 0 0.5rem;
	font-size: 1.05rem;
}

.pbp-cal-entry__when .pbp-cal-time {
	display: block;
	font-size: 0.9rem;
}

/* A window reads as one line: "1 Oct 2026 – 15 Nov 2026". */
.pbp-cal-entry--exposure .pbp-cal-entry__when .pbp-cal-time,
.pbp-cal-entry--exposure .pbp-cal-entry__when .pbp-cal-range-sep,
.pbp-cal-entry--exposure .pbp-cal-entry__when .pbp-cal-open {
	display: inline;
}

.pbp-cal-entry__meta,
.pbp-cal-entry__holders {
	margin: 0.4rem 0 0;
	font-size: 0.85rem;
	color: #555;
}

.pbp-cal-entry__text {
	margin: 0.5rem 0 0;
	font-size: 0.9rem;
}

.pbp-cal-entry__actions {
	margin: 0.9rem 0 0;
}

/* ---------------------------------------------------------------- Subscribe */

.pbp-cal-subscribe {
	margin-top: 2rem;
	padding-top: 1.25rem;
	border-top: 1px solid #e2e2e2;
}

.pbp-cal-subscribe__title {
	margin: 0 0 0.35rem;
	font-size: 0.95rem;
}

.pbp-cal-subscribe__text {
	margin: 0 0 0.75rem;
	font-size: 0.9rem;
	color: #555;
}

.pbp-cal-subscribe__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin: 0;
}

/* A theme that styles .wp-element-button takes over; this is the fallback so
   the link is never invisible text on the page. */
.pbp-cal-btn {
	display: inline-block;
	padding: 0.6rem 1.1rem;
	border-radius: 0.35rem;
	text-decoration: none;
}

.pbp-cal-btn:not(.wp-element-button) {
	background: #c00000;
	color: #fff;
	font-weight: 600;
}

.pbp-cal-link {
	color: #c00000;
}

@media (max-width: 600px) {
	.pbp-cal-controls {
		gap: 0.5rem;
	}

	.pbp-cal-tzfield {
		flex: 1 1 100%;
	}

	.pbp-cal-tz {
		flex: 1 1 auto;
		max-width: none;
	}
}
