/*
 * TC Manta Training — front-end styling.
 * Palette and fonts taken from tcmanta.de (Inspiro theme, teal dive-club brand,
 * Poppins headings / Noto Sans body). Scoped under .tcm-training so it never
 * leaks into the surrounding theme.
 */

.tcm-training {
	--tcm-brand:        #0bb4aa;
	--tcm-brand-bright: #28c9c9;
	--tcm-brand-dark:   #37746f;
	--tcm-brand-tint:   #e6f7f5;
	--tcm-ink:          #101010;
	--tcm-muted:        #6c6c77;
	--tcm-red:          #cf2e2e;
	--tcm-red-tint:     #fbe4e4;
	--tcm-card:         #ffffff;
	--tcm-border:       #e6e9f0;

	color: var(--tcm-ink);
	font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Per-training colour palette (from the site's WP preset colours) --- */
.tcm-c0 { --c: #0bb4aa; --c-tint: #d3efec; }
.tcm-c1 { --c: #0693e3; --c-tint: #d3ebfb; }
.tcm-c2 { --c: #9b51e0; --c-tint: #ece0fa; }
.tcm-c3 { --c: #ff6900; --c-tint: #ffe2cf; }
.tcm-c4 { --c: #00d084; --c-tint: #cdf3e3; }
.tcm-c5 { --c: #fcb900; --c-tint: #fff0c7; }

.tcm-swatch {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	border-radius: 3px;
	background: var(--c, #ccc);
}

/* --- Legend --- */
.tcm-legend {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em 1.2em;
	margin: 0 0 1.2em;
	padding: 0;
	font-size: 0.9em;
}

.tcm-legend li { margin: 0; }

.tcm-legend a {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	text-decoration: none;
	color: var(--tcm-ink);
}

.tcm-legend a:hover { color: var(--tcm-brand-dark); }

/* --- Month sections (current expanded; later folded) --- */
.tcm-cal-month { margin: 0 0 1.1em; }

.tcm-cal-month__title {
	font-family: 'Poppins', 'Noto Sans', sans-serif;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--tcm-brand);
	margin: 0 0 0.6em;
}

details.tcm-cal-month > summary.tcm-cal-month__title {
	cursor: pointer;
	margin: 0;
	padding: 0.35em 0;
}

details.tcm-cal-month[open] > summary.tcm-cal-month__title { margin-bottom: 0.6em; }
details.tcm-cal-month > summary::marker { color: var(--tcm-brand); }

/* --- Compact single-week widget --- */
.tcm-compact__title {
	font-family: 'Poppins', 'Noto Sans', sans-serif;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--tcm-brand);
	margin: 0 0 0.6em;
}

.tcm-compact .tcm-cal { max-width: none; }

/* --- Calendar grid --- */
.tcm-cal {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 3px;
	max-width: 30em;
}

.tcm-cal__head {
	text-align: center;
	font-size: 0.72em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--tcm-muted);
	padding-bottom: 0.2em;
}

.tcm-cal__day {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	background: #f4f5f8;
}

.tcm-cal__day.is-empty { background: transparent; }

.tcm-cal__num {
	position: absolute;
	top: 3px;
	left: 5px;
	z-index: 2;
	font-size: 0.78em;
	font-weight: 600;
	line-height: 1;
	color: var(--tcm-ink);
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}

.tcm-cal__day.is-today {
	outline: 3px solid var(--tcm-brand);
	outline-offset: -3px;
}

.tcm-cal__day.is-past { background: #f0f1f4; }
.tcm-cal__day.is-past .tcm-cal__num { color: #aeb3bd; font-weight: 400; }

/* Coloured training segment(s) — fill the cell, or split into halves. */
.tcm-cal__seg {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 6px;
	background: var(--c-tint);
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tcm-cal__emoji {
	font-size: 1.7em;
	line-height: 1;
	pointer-events: none;
}

.tcm-cal__day.is-split .tcm-cal__seg:first-of-type {
	right: 50%;
	border-radius: 6px 0 0 6px;
}
.tcm-cal__day.is-split .tcm-cal__seg:last-of-type {
	left: 50%;
	border-radius: 0 6px 6px 0;
}

.tcm-cal__seg:hover { filter: brightness(0.95); }

/* Cancelled training: thick red X struck over the whole cell / emoji. */
.tcm-cal__seg.is-off { background: var(--tcm-red-tint); }

.tcm-cal__seg.is-off::before,
.tcm-cal__seg.is-off::after {
	content: "";
	position: absolute;
	top: 8%;
	left: 50%;
	width: 4px;
	height: 84%;
	background: var(--tcm-red);
	border-radius: 2px;
	z-index: 2;
}
.tcm-cal__seg.is-off::before { transform: translateX(-50%) rotate(45deg); }
.tcm-cal__seg.is-off::after  { transform: translateX(-50%) rotate(-45deg); }

.tcm-cal__day.is-cancelled .tcm-cal__num {
	text-decoration: line-through;
	color: var(--tcm-red);
}

/* --- Training details --- */
.tcm-training-details { margin-top: 1.5em; }

.tcm-training-item {
	background: var(--tcm-card);
	border: 1px solid var(--tcm-border);
	border-left: 4px solid var(--tcm-brand);
	border-radius: 10px;
	padding: 1em 1.25em 1.15em;
	margin: 0 0 1em;
	box-shadow: 0 1px 3px rgba(16, 16, 16, 0.06);
	/* Land below the theme's sticky header when jumped to from the calendar. */
	scroll-margin-top: 5rem;
}

.tcm-training-item__title {
	font-family: 'Poppins', 'Noto Sans', sans-serif;
	font-weight: 700;
	color: var(--tcm-ink);
	margin: 0 0 0.5em;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.tcm-training-item__meta {
	list-style: none;
	margin: 0 0 0.6em;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.2em 1.3em;
	font-size: 0.92em;
}

.tcm-training-item__meta li { margin: 0; color: var(--tcm-muted); }

.tcm-training-item__meta strong {
	color: var(--tcm-ink);
	font-weight: 600;
	margin-right: 0.25em;
}

.tcm-training-item__desc { margin: 0.5em 0 0.7em; color: var(--tcm-ink); }

.tcm-training-item__next {
	display: inline-flex;
	align-items: baseline;
	gap: 0.5em;
	margin: 0.6em 0 0;
	padding: 0.3em 0.75em;
	background: var(--tcm-brand-tint);
	border-left: 3px solid var(--tcm-brand);
	border-radius: 6px;
}

.tcm-next-label {
	font-size: 0.82em;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--tcm-brand-dark);
}

.tcm-next-when {
	font-family: 'Poppins', 'Noto Sans', sans-serif;
	font-weight: 700;
	font-size: 1.1em;
	color: var(--tcm-ink);
}

.tcm-training-empty { font-style: italic; color: var(--tcm-muted); }

/* Flash highlight when jumped to from the calendar (progressive enhancement). */
@keyframes tcm-flash {
	0%   { box-shadow: 0 0 0 3px var(--tcm-brand-bright); }
	100% { box-shadow: 0 0 0 3px rgba(40, 201, 201, 0); }
}
.tcm-training-item.is-flash { animation: tcm-flash 1.3s ease-out; }

/* --- Small screens --- */
@media (max-width: 600px) {
	.tcm-training-item { padding: 0.9em 1em; }
	.tcm-cal { max-width: none; gap: 2px; }
	.tcm-cal__num { font-size: 0.72em; top: 2px; left: 3px; }
	.tcm-cal__emoji { font-size: 1.35em; }
}
