/**
 * Teams Group Calendar
 *
 * This lives inside someone else's theme, so it borrows the theme's typography
 * and colour instead of introducing its own. Everything is derived from
 * currentColor, which means it also survives a dark theme without a second
 * stylesheet. Override any of the custom properties below to reskin it.
 */

.tgc {
	/* Fallbacks for browsers without color-mix. */
	--tgc-line: rgba( 0, 0, 0, 0.14 );
	--tgc-muted: rgba( 0, 0, 0, 0.62 );
	--tgc-well: rgba( 0, 0, 0, 0.03 );
	--tgc-accent: currentColor;
	--tgc-rail: 3.25rem;
	--tgc-gap: 1.25rem;
	--tgc-radius: 3px;

	font-family: inherit;
	color: inherit;
	margin: 0 0 2rem;
}

@supports ( color: color-mix( in srgb, currentColor 50%, transparent ) ) {
	.tgc {
		--tgc-line: color-mix( in srgb, currentColor 16%, transparent );
		--tgc-muted: color-mix( in srgb, currentColor 62%, transparent );
		--tgc-well: color-mix( in srgb, currentColor 4%, transparent );
	}
}

.tgc *,
.tgc *::before,
.tgc *::after {
	box-sizing: border-box;
}

.tgc__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

.tgc__title {
	margin: 0 0 0.75rem;
}

.tgc__status {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Month navigation                                                     */
/* ------------------------------------------------------------------ */

.tgc__form {
	margin: 0;
}

.tgc__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0 0 0.75rem;
	border-bottom: 1px solid var( --tgc-line );
}

.tgc__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	flex: 0 0 auto;
	border: 1px solid var( --tgc-line );
	border-radius: var( --tgc-radius );
	color: inherit;
	text-decoration: none;
	line-height: 1;
	transition: border-color 120ms ease, background-color 120ms ease;
}

.tgc__step:hover,
.tgc__step:focus-visible {
	border-color: currentColor;
	background: var( --tgc-well );
}

.tgc__step:focus-visible {
	outline: 2px solid var( --tgc-accent );
	outline-offset: 2px;
}

.tgc__step--off {
	opacity: 0.28;
	cursor: default;
}

.tgc__month {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
}

.tgc__select {
	font: inherit;
	color: inherit;
	max-width: 100%;
	padding: 0.35rem 0.5rem;
	border: 1px solid var( --tgc-line );
	border-radius: var( --tgc-radius );
	background-color: transparent;
}

.tgc__select:focus-visible {
	outline: 2px solid var( --tgc-accent );
	outline-offset: 1px;
}

.tgc__go {
	font: inherit;
	padding: 0.35rem 0.75rem;
	border: 1px solid var( --tgc-line );
	border-radius: var( --tgc-radius );
	background: transparent;
	color: inherit;
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* The list                                                             */
/* ------------------------------------------------------------------ */

.tgc__list {
	margin: 0;
}

.tgc__day {
	display: grid;
	grid-template-columns: var( --tgc-rail ) 1fr;
	gap: var( --tgc-gap );
	padding: 1.25rem 0;
	border-bottom: 1px solid var( --tgc-line );
}

/*
 * The rail is the one deliberate flourish: the date is the grouping key, so it
 * gets to be the structure rather than a repeated line of text above each event.
 */
.tgc__rail {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	line-height: 1;
	padding-top: 0.15rem;
}

.tgc__dow {
	font-size: 0.7rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var( --tgc-muted );
	margin-bottom: 0.3rem;
}

.tgc__dom {
	font-size: 1.75rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
}

.tgc__day--today .tgc__dom {
	position: relative;
}

.tgc__day--today .tgc__dom::after {
	content: "";
	display: block;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var( --tgc-accent );
	margin: 0.35rem auto 0;
}

.tgc__stack {
	min-width: 0;
}

.tgc__events {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tgc__event + .tgc__event {
	margin-top: 1.1rem;
	padding-top: 1.1rem;
	border-top: 1px dotted var( --tgc-line );
}

.tgc__when {
	margin: 0 0 0.15rem;
	font-size: 0.8rem;
	font-variant-numeric: tabular-nums;
	color: var( --tgc-muted );
}

.tgc__subject {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.35;
	font-weight: 600;
}

.tgc__meta {
	margin: 0.2rem 0 0;
	font-size: 0.875rem;
	color: var( --tgc-muted );
}

.tgc__meta--where::before {
	content: "";
	display: inline-block;
	width: 0.45rem;
	height: 0.45rem;
	margin-right: 0.4rem;
	border: 1px solid currentColor;
	border-radius: 50% 50% 50% 0;
	transform: rotate( -45deg ) translateY( -1px );
	vertical-align: middle;
	opacity: 0.7;
}

.tgc__details {
	margin: 0.45rem 0 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: var( --tgc-muted );
	white-space: pre-line;
}

.tgc__flag {
	display: inline-block;
	margin: 0.3rem 0 0;
	padding: 0.1rem 0.4rem;
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border: 1px solid var( --tgc-line );
	border-radius: var( --tgc-radius );
	color: var( --tgc-muted );
}

.tgc__event--cancelled .tgc__subject {
	text-decoration: line-through;
	text-decoration-thickness: 1px;
	color: var( --tgc-muted );
}

.tgc__join {
	margin: 0.45rem 0 0;
	font-size: 0.875rem;
}

.tgc__empty,
.tgc__error {
	margin: 1.5rem 0;
	color: var( --tgc-muted );
}

.tgc__error--admin {
	padding: 0.6rem 0.75rem;
	border-left: 3px solid var( --tgc-accent );
	background: var( --tgc-well );
	font-size: 0.875rem;
}

/* ------------------------------------------------------------------ */
/* States                                                               */
/* ------------------------------------------------------------------ */

.tgc__inner {
	transition: opacity 140ms ease;
}

.tgc.is-loading .tgc__inner {
	opacity: 0.45;
}

.tgc.is-loading .tgc__list {
	pointer-events: none;
}

@media ( max-width: 480px ) {
	.tgc {
		--tgc-rail: 2.5rem;
		--tgc-gap: 0.9rem;
	}

	.tgc__dom {
		font-size: 1.4rem;
	}

	.tgc__select {
		max-width: 11rem;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.tgc__inner,
	.tgc__step {
		transition: none;
	}
}
