/* Calendar layer switches and the holiday / school labels. Colours, fonts and sizes use the site's branding variables only. */

.jds-cal-layers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-8) var(--space-16);
	margin: 0 0 var(--space-16);
}

/* The pill is the switch. Off: hollow, 1px outline in the layer colour, hollow dot. On: filled with the layer colour, solid dot. */
.jds-cal-switch {
	--layer: var(--color-accent);
	--layer-line: var(--color-accent);
	--layer-ink: var(--color-on-accent);
	display: inline-flex;
	align-items: center;
	gap: var(--space-8);
	min-height: 44px;
	padding: 0 var(--space-16);
	border: 1px solid var(--layer-line);
	border-radius: 999px;
	background: transparent;
	color: var(--color-ink);
	font-family: var(--font-body), sans-serif;
	font-size: var(--font-size-small);
	font-weight: 400;
	line-height: 1.2;
	cursor: pointer;
}

/* Sun on white is too pale for a 3:1 outline, so Holidays draws its line in the deeper gold. */
.jds-cal-switch[data-layer="holiday"] {
	--layer: var(--color-sun);
	--layer-line: var(--color-sun-deep);
	--layer-ink: var(--color-on-sun);
}

.jds-cal-switch[data-layer="school"] {
	--layer: var(--color-teal-deep);
	--layer-line: var(--color-teal-deep);
	--layer-ink: var(--color-on-teal-deep);
}

.jds-cal-switch:focus-visible {
	outline: 3px solid var(--color-ink);
	outline-offset: 2px;
}

.jds-cal-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 1px solid var(--layer-line);
	background: transparent;
	flex: none;
	box-sizing: border-box;
}

.jds-cal-switch[aria-checked="true"] {
	background: var(--layer);
	color: var(--layer-ink);
}

.jds-cal-switch[aria-checked="true"] .jds-cal-dot {
	border-color: var(--layer-ink);
	background: var(--layer-ink);
}

/* Where the school dates come from. */
.jds-cal-source {
	margin: var(--space-16) 0 0;
	color: var(--color-text-muted);
	font-family: var(--font-body), sans-serif;
	font-size: var(--font-size-caption);
	line-height: 1.5;
}

.jds-cal-source a {
	color: inherit;
	text-decoration: underline;
}

html.jds-cal-off-school .jds-cal-source {
	display: none;
}

/* Layers off: the entries stay in the page and are only hidden. */
html.jds-cal-off-events .jet-calendar-week__day-event:not([data-jds-layer]),
html.jds-cal-off-holiday .jet-calendar-week__day-event[data-jds-layer="holiday"],
html.jds-cal-off-school .jet-calendar-week__day-event[data-jds-layer="school"] {
	display: none;
}

/* A day whose entries are all switched off is drawn as an empty day (phones show a dot for days with entries). */
.jet-calendar .jds-cal-empty .jet-calendar-week__day-mobile-wrap {
	display: none;
}

/* Small screens: JetEngine turns a day with entries into one square. It becomes one square per visible layer, coloured like the switch dots. */
.jet-calendar .jet-calendar-week__day .jet-calendar-week__day-mobile-trigger {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	width: auto;
	min-width: 24px;
	background: none;
}

.jds-cal-pip {
	display: block;
	width: var(--space-8);
	height: var(--space-8);
	border-radius: 2px;
	background: var(--color-accent);
}

.jds-cal-pip--holiday {
	background: var(--color-sun);
}

.jds-cal-pip--school {
	background: var(--color-teal-deep);
}

/* A week with nothing visible in it is a short row: day numbers stay, the empty space goes. */
.jet-calendar .jet-calendar-week.jds-cal-week-empty .jet-calendar-week__day-content {
	min-height: 0;
	padding-block: 0;
}

.jet-calendar .jet-calendar-week.jds-cal-week-empty .jet-calendar-week__day {
	height: auto;
	padding-block: var(--space-8);
}

.jet-calendar .jet-calendar-week.jds-cal-week-empty .jet-calendar-week__day-header {
	margin-bottom: 0;
}

/* Holiday and school labels in the day cell. */
.jet-calendar .jet-calendar-week__day-event[data-jds-layer] {
	filter: none;
	margin: 0 0 4px;
	padding: 0;
	background: none;
	border: 0;
	box-shadow: none;
}

.jds-cal-entry {
	display: block;
	padding: 3px 8px;
	border-radius: 6px;
	background: color-mix(in srgb, var(--color-sun) 24%, var(--color-paper));
	color: var(--color-ink);
	font-family: var(--font-body), sans-serif;
	font-size: var(--font-size-micro);
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.jds-cal-entry--school {
	background: color-mix(in srgb, var(--color-teal) 16%, var(--color-paper));
}

.jds-cal-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
