/*
 * Month calendar (template-parts/calendar/month.php) + day dialog.
 * Mobile: list of days with events. From 768px: 7-column grid as in the design.
 */

.bs-cal {
	position: relative;
}

.bs-cal.is-loading {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.15s;
}

/* ---------- Heading + month switcher ---------- */

.bs-cal__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px 24px;
	margin-bottom: 24px;
}

/* The heading may wrap; the month switcher keeps its place and size every month. */
.bs-cal__heading {
	flex: 1 1 320px;
	min-width: 0;
}

.bs-cal__nav {
	display: flex;
	flex: none;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

@media (min-width: 768px) {
	/* Next to the heading: line the switcher up with the title's FIRST line, so it stays
	   put when a longer month name wraps the title onto two lines. */
	.bs-cal__head {
		align-items: flex-start;
	}

	.bs-cal__heading .eyebrow {
		line-height: 16px;
	}

	.bs-cal__heading + .bs-cal__nav {
		margin-top: calc(28px + (0.95 * clamp(32px, 4vw, 56px) - 44px) / 2);
	}
}

.bs-cal__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 1px solid var(--bs-line-strong);
	font-size: 18px;
	line-height: 1;
	color: var(--bs-text);
}

a.bs-cal__arrow:hover {
	border-color: var(--bs-accent);
	color: var(--bs-accent);
}

.bs-cal__arrow.is-disabled {
	opacity: 0.3;
}

.bs-cal__label {
	/* Fixed width (fits "PAŹDZIERNIK 2026" / "SEPTEMBER 2026"), so the arrows never move. */
	width: 11.5em;
	white-space: nowrap;
	font-family: var(--bs-font-display);
	font-size: 16px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-align: center;
}

/* ---------- Phone: list of days ---------- */

.bs-cal__weekday,
.bs-cal__cell.is-blank,
.bs-cal--site .bs-cal__cell.is-empty,
.bs-cal--site .bs-cal__cell.is-past:not(.is-today),
.bs-cal__more,
.bs-cal__tip {
	display: none;
}

.bs-cal__cell {
	display: grid;
	grid-template-columns: 58px minmax(0, 1fr);
	gap: 14px;
	padding: 14px 0;
	border-top: 1px solid var(--bs-line);
}

.bs-cal--panel .bs-cal__cell.is-empty {
	display: none;
}

.bs-cal__num {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	padding: 0;
	background: none;
	border: 0;
	text-align: left;
	color: var(--bs-text);
	cursor: pointer;
}

span.bs-cal__num {
	cursor: default;
}

.bs-cal__dow {
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--bs-text-subtle);
}

.bs-cal__day {
	font-family: var(--bs-font-display);
	font-size: 28px;
	font-weight: 900;
	line-height: 1;
	letter-spacing: -0.02em;
}

.bs-cal__cell.is-today .bs-cal__day,
.bs-cal__cell.is-today .bs-cal__dow {
	color: var(--bs-accent);
}

/* Phone list: today gets a pink frame too. */
.bs-cal__cell.is-today {
	padding-inline: 12px;
	box-shadow: inset 0 0 0 2px var(--bs-accent);
}

.bs-cal__items {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
}

/* Event chip */
.bs-chip {
	--type-color: var(--bs-accent);
	min-width: 0;
}

.bs-chip__link {
	display: block;
	padding: 8px 10px;
	border-left: 3px solid var(--type-color);
	background: var(--bs-surface-2);
	background: color-mix(in srgb, var(--type-color) 16%, transparent);
	color: var(--bs-text);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.bs-chip__link:hover {
	color: var(--bs-text);
	background: color-mix(in srgb, var(--type-color) 28%, transparent);
}

.bs-chip__time {
	margin-right: 4px;
	font-weight: 700;
}

.bs-chip__full {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bs-accent);
}

.bs-chip.is-full .bs-chip__title {
	text-decoration: line-through;
	text-decoration-color: rgba(251, 221, 223, 0.5);
}

.bs-tag {
	display: inline-block;
	padding: 2px 5px;
	border: 1px solid var(--bs-line-strong);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.1em;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--bs-text-subtle);
}

.bs-tag--hidden {
	border-color: var(--bs-accent);
	color: var(--bs-accent);
}

.bs-tag--draft {
	border-style: dashed;
}

/* Seats line ("Zostało 5 z 32 miejsc") */
.bs-seats {
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--bs-text-muted);
}

.bs-seats.is-low,
.bs-seats.is-full {
	color: var(--bs-accent);
}

.bs-cal__empty {
	margin: 16px 0 0;
	color: var(--bs-text-muted);
}

/* ---------- Phone, site calendar: small month grid + the chosen day's programme ---------- */

@media (max-width: 767px) {
	.bs-cal--site .bs-cal__grid {
		display: grid;
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 4px;
	}

	.bs-cal--site .bs-cal__weekday {
		display: block;
		padding: 4px 0 6px;
		font-size: 10.5px;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-align: center;
		text-transform: uppercase;
		color: var(--bs-text-subtle);
	}

	.bs-cal--site .bs-cal__cell,
	.bs-cal--site .bs-cal__cell.is-blank,
	.bs-cal--site .bs-cal__cell.is-empty,
	.bs-cal--site .bs-cal__cell.is-past:not(.is-today) {
		display: flex;
		position: relative;
		aspect-ratio: 1;
		padding: 0;
		background: var(--bs-surface);
		border: 1px solid var(--bs-line);
	}

	.bs-cal--site .bs-cal__cell.is-blank {
		background: none;
		border-color: transparent;
	}

	.bs-cal--site .bs-cal__num {
		flex: 1;
		align-items: center;
		justify-content: center;
		width: 100%;
	}

	.bs-cal--site .bs-cal__dow,
	.bs-cal--site .bs-cal__items {
		display: none;
	}

	.bs-cal--site .bs-cal__day {
		font-size: 16px;
		letter-spacing: 0;
	}

	.bs-cal--site .bs-cal__cell.is-past .bs-cal__day {
		opacity: 0.35;
	}

	/* Dot = there are events that day. */
	.bs-cal--site .bs-cal__cell.has-events .bs-cal__num::after {
		content: '';
		position: absolute;
		left: 50%;
		bottom: 6px;
		width: 6px;
		height: 6px;
		margin-left: -3px;
		border-radius: 50%;
		background: var(--bs-accent);
	}

	.bs-cal--site .bs-cal__cell.has-events {
		border-color: rgba(255, 46, 126, 0.45);
	}

	.bs-cal--site .bs-cal__cell.is-today {
		padding-inline: 0;
		box-shadow: inset 0 0 0 2px var(--bs-accent);
	}

	/* .has-events in the selector: must beat the past-day rule above (also for past days). */
	.bs-cal--site .bs-cal__cell.has-events.is-selected {
		background: var(--bs-accent);
		border-color: var(--bs-accent);
	}

	.bs-cal--site .bs-cal__cell.has-events.is-selected .bs-cal__day {
		color: var(--bs-on-accent);
		opacity: 1;
	}

	.bs-cal--site .bs-cal__cell.has-events.is-selected .bs-cal__num::after {
		background: var(--bs-on-accent);
	}

	.bs-cal__agenda {
		margin-top: 20px;
		padding-top: 18px;
		border-top: 1px solid var(--bs-line);
	}

	.bs-cal__agenda:empty {
		display: none;
	}
}

@media (min-width: 768px) {
	.bs-cal__agenda {
		display: none; /* Desktop uses the hover details and the day dialog. */
	}
}

/* ---------- Tablet / desktop: grid ---------- */

@media (min-width: 768px) {
	.bs-cal__head {
		margin-bottom: 32px;
	}

	.bs-cal__grid {
		display: grid;
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 1px;
		background: var(--bs-line);
		border: 1px solid var(--bs-line);
	}

	.bs-cal__weekday {
		display: block;
		padding: 12px 4px;
		background: var(--bs-surface);
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.18em;
		text-align: center;
		text-transform: uppercase;
		color: rgba(251, 221, 223, 0.55);
	}

	.bs-cal__cell,
	.bs-cal__cell.is-blank,
	.bs-cal--site .bs-cal__cell.is-empty,
	.bs-cal--site .bs-cal__cell.is-past:not(.is-today),
	.bs-cal--panel .bs-cal__cell.is-empty {
		display: flex;
		flex-direction: column;
		position: relative;
		min-width: 0;
		gap: 0;
		min-height: 124px;
		padding: 10px;
		border: 0;
		background: var(--bs-bg);
		transition: background-color 0.15s;
	}

	.bs-cal__cell.is-blank {
		background: var(--bs-bg-muted);
	}

	.bs-cal__cell.is-today {
		background: var(--bs-surface-today);
		box-shadow: inset 0 0 0 2px var(--bs-accent);
	}

	.bs-cal__cell.is-today .bs-cal__day {
		color: var(--bs-accent);
	}

	.bs-cal--site .bs-cal__cell.has-events {
		cursor: pointer;
	}

	.bs-cal--site .bs-cal__cell.has-events:hover {
		background: var(--bs-surface-hover);
	}

	.bs-cal__num {
		display: block;
		align-self: flex-start;
		line-height: 1.3;
	}

	.bs-cal__dow {
		display: none;
	}

	.bs-cal__day {
		font-family: var(--bs-font-display);
		font-size: 14px;
		font-weight: 800;
		letter-spacing: 0;
		color: rgba(251, 221, 223, 0.3);
	}

	.bs-cal__cell.has-events .bs-cal__day {
		color: var(--bs-text);
	}

	.bs-cal__cell.is-past:not(.is-today) {
		opacity: 0.55;
	}

	.bs-cal__items {
		gap: 4px;
		margin-top: 8px;
	}

	.bs-chip.is-extra {
		display: none;
	}

	.bs-chip__link {
		padding: 5px 7px;
		font-size: 11.5px;
		line-height: 1.25;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.bs-chip__time {
		margin-right: 2px;
		font-weight: 600;
	}

	.bs-chip__full {
		font-size: 9.5px;
	}

	.bs-cal__more {
		display: block;
		align-self: flex-start;
		margin-top: 2px;
		padding: 2px 7px;
		background: none;
		border: 0;
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.04em;
		color: var(--bs-accent);
		cursor: pointer;
	}

	/* Panel month: same look as the public calendar + seats; click a day for the full list */
	.bs-cal--panel .bs-cal__cell.is-weekend {
		background: var(--bs-bg-weekend);
	}

	.bs-cal--panel .bs-cal__cell.is-today {
		background: var(--bs-surface-today);
	}

	.bs-cal--panel .bs-cal__cell.has-events {
		cursor: pointer;
	}

	.bs-cal--panel .bs-cal__cell.has-events:hover {
		background: var(--bs-surface-hover);
	}

	.bs-cal--panel .bs-chip__link {
		display: flex;
		align-items: center;
		gap: 4px;
	}

	.bs-cal--panel .bs-chip__title {
		flex: 1;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.bs-cal--panel .bs-chip__seats {
		flex: none;
		font-size: 10px;
		font-weight: 700;
		color: var(--bs-text-muted);
	}

	.bs-cal--panel .bs-chip__seats.is-full {
		color: var(--bs-accent);
	}

}

/* Panel: hidden = pink dashed frame, draft = grey dashed frame (month chips, day list) */
.bs-cal--panel .bs-chip.is-hidden-event .bs-chip__link,
.bs-dayitem.is-hidden-event {
	outline: 1px dashed var(--bs-accent);
	outline-offset: -1px;
}

.bs-cal--panel .bs-chip.is-draft .bs-chip__link,
.bs-dayitem.is-draft {
	outline: 1px dashed rgba(251, 221, 223, 0.6);
	outline-offset: -1px;
}

.bs-cal--panel .bs-chip.is-draft .bs-chip__link {
	opacity: 0.75;
}

/* Hover details – only with a real mouse */
@media (min-width: 768px) and (hover: hover) {
	.bs-cal__tip {
		position: absolute;
		z-index: 40;
		left: 50%;
		bottom: calc(100% - 6px);
		width: 290px;
		padding: 6px 16px 14px;
		background: var(--bs-surface);
		border: 1px solid var(--bs-accent);
		box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
		transform: translateX(-50%);
		pointer-events: none;
	}

	.bs-cal__cell.col-1 .bs-cal__tip {
		left: 0;
		transform: none;
	}

	.bs-cal__cell.col-7 .bs-cal__tip {
		left: auto;
		right: 0;
		transform: none;
	}

	.bs-cal__cell.has-events:hover .bs-cal__tip {
		display: block;
	}
}

.bs-cal__tip-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px 0;
	border-bottom: 1px solid rgba(251, 221, 223, 0.1);
}

.bs-cal__tip-type,
.bs-dayitem__type {
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--bs-accent);
}

.bs-cal__tip-title {
	font-family: var(--bs-font-display);
	font-size: 15px;
	font-weight: 800;
	line-height: 1.2;
}

.bs-cal__tip-meta {
	font-size: 13px;
	color: rgba(251, 221, 223, 0.66);
}

.bs-cal__tip-hint {
	display: block;
	margin-top: 10px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--bs-text-subtle);
}

/* ---------- Day dialog ("Program dnia") ---------- */

.bs-dialog {
	width: min(560px, calc(100% - 32px));
	max-height: 82vh;
	padding: 0; /* Padding sits on the content, so a click on <dialog> itself = backdrop. */
	background: var(--bs-surface);
	border: 1px solid var(--bs-line-strong);
	color: var(--bs-text);
}

.bs-dialog::backdrop {
	background: rgba(8, 15, 38, 0.78);
}

.bs-dialog__close {
	position: absolute;
	top: 18px;
	right: 18px;
	width: 40px;
	height: 40px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: rgba(251, 221, 223, 0.5);
	cursor: pointer;
}

.bs-dialog__close:hover {
	color: var(--bs-accent);
}

.bs-dialog__content {
	padding: 28px 24px 26px;
}

.bs-dialog .eyebrow {
	font-size: 11px;
	letter-spacing: 0.22em;
	margin-bottom: 8px;
}

.bs-dialog__title {
	padding-right: 40px;
	font-size: 26px;
	letter-spacing: -0.02em;
}

.bs-dayitems {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 22px 0 0;
	padding: 0;
	list-style: none;
}

.bs-dayitem {
	--type-color: var(--bs-accent);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 16px 18px;
	border: 1px solid var(--bs-line);
	border-left: 3px solid var(--type-color);
}

.bs-dayitem__body {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.bs-dayitem__title {
	font-family: var(--bs-font-display);
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
}

.bs-dayitem__meta {
	font-size: 13.5px;
	color: rgba(251, 221, 223, 0.6);
}

.bs-dayitem .btn {
	padding: 11px 18px;
	font-size: 11.5px;
}

@media (min-width: 768px) {
	.bs-dialog__content {
		padding: 28px 30px 30px;
	}
}

/* ---------- Laptops (short screens): the whole month fits on screen ----------
   Day rows shrink with the window height (never below the space one or two events need);
   tall screens keep the full 124px rows above. */

@media (min-width: 768px) and (max-height: 1000px) {
	.bs-cal__head {
		margin-bottom: 20px;
	}

	.bs-cal__weekday {
		padding-block: 8px;
	}

	.bs-cal__cell,
	.bs-cal__cell.is-blank,
	.bs-cal--site .bs-cal__cell.is-empty,
	.bs-cal--site .bs-cal__cell.is-past:not(.is-today),
	.bs-cal--panel .bs-cal__cell.is-empty {
		min-height: clamp(64px, calc((100vh - 340px) / 6), 124px);
		padding: 7px 8px;
	}

	.bs-cal__items {
		gap: 3px;
		margin-top: 4px;
	}

	.bs-chip__link {
		padding: 3px 6px;
	}

	.bs-cal__more {
		margin-top: 0;
		padding-block: 0;
	}
}
