/*
 * Использует CSS-переменные темы (--brand-cream, --brand-warm,
 * --brand-accent, --brand-dark, --brand-muted) — они объявлены на :root
 * в style.css темы, который на сайте всегда подключён раньше этого
 * файла, так что свои переопределения тут не нужны.
 */

.mphc-calendar {
	margin: 24px 0 8px;
}

.mphc-calendar__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	margin-bottom: 18px;
}

.mphc-calendar__nav-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	border-radius: 50%;
	border: 1px solid rgba(201, 122, 62, 0.3);
	background: transparent;
	color: var(--brand-warm);
	text-decoration: none;
	font: inherit;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s ease;
}

.mphc-calendar__nav-link:hover {
	background: var(--brand-warm);
	color: #fff;
}

.mphc-calendar__title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--brand-dark);
	min-width: 220px;
	text-align: center;
	text-transform: capitalize;
}

.mphc-calendar__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}

.mphc-calendar__weekday {
	text-align: center;
	font-weight: 600;
	font-size: 0.8rem;
	color: var(--brand-muted);
	padding: 4px 0 8px;
	text-transform: uppercase;
}

/*
 * min-width: 0 is the actual fix for equal column widths — a grid item
 * with unwrapped/long content (the holiday badge below, before this was
 * added) forces its 1fr track wider than its neighbours no matter what
 * the track sizing says, because "auto" min-width (the grid default)
 * means "at least as wide as my content's own minimum". Setting it to 0
 * lets the track actually shrink to 1fr and pushes the wrapping problem
 * onto the badge text (which is fine — see .mphc-calendar__holiday).
 */
.mphc-calendar__day {
	min-width: 0;
	min-height: 88px;
	border-radius: 0.8rem;
	padding: 8px;
	background: var(--brand-cream);
	border: 1px solid rgba(201, 122, 62, 0.15);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mphc-calendar__day--empty {
	background: transparent;
	border: none;
}

.mphc-calendar__day-number {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--brand-dark);
}

/* Прошедшие даты — серым. */
.mphc-calendar__day--past {
	background: #ececec;
	border-color: #e0e0e0;
}

.mphc-calendar__day--past .mphc-calendar__day-number {
	color: #999;
}

/* Сегодня — выделенным цветом темы (тёплый акцент). */
.mphc-calendar__day--today {
	background: var(--brand-warm);
	border-color: var(--brand-warm);
}

.mphc-calendar__day--today .mphc-calendar__day-number {
	color: #fff;
}

/* Будущие даты — бежевый (тот же --brand-cream, что и фон карточек по
   умолчанию, оставлено явно для ясности, что это осознанный выбор, а не
   "ничего не переопределено"). */
.mphc-calendar__day--future {
	background: var(--brand-cream);
}

.mphc-calendar__day--has-holiday {
	box-shadow: 0 2px 10px rgba(24, 13, 8, 0.08);
}

.mphc-calendar__holidays {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.mphc-calendar__holiday {
	display: block;
	font-size: 0.72rem;
	line-height: 1.25;
	padding: 2px 6px;
	border-radius: 0.5rem;
	background: var(--brand-accent);
	color: var(--brand-dark);
	text-decoration: none;
	font-weight: 600;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.mphc-calendar__day--today .mphc-calendar__holiday {
	background: #fff;
}

.mphc-calendar__holiday:hover {
	background: var(--brand-warm);
	color: #fff;
}

@media (max-width: 600px) {
	.mphc-calendar__grid {
		gap: 3px;
	}

	.mphc-calendar__day {
		min-height: 60px;
		padding: 4px;
		border-radius: 0.5rem;
	}

	.mphc-calendar__day-number {
		font-size: 0.78rem;
	}

	.mphc-calendar__holiday {
		font-size: 0.6rem;
		padding: 1px 4px;
	}

	.mphc-calendar__title {
		min-width: auto;
		font-size: 1rem;
	}

	.mphc-calendar__nav {
		gap: 12px;
	}
}
