/**
 * ThemeFour Shamsi — [shamsi_calendar] widget.
 *
 * Self-contained (loads on the front end and in the control-panel preview).
 * Colors come from inline CSS variables set by the shortcode, defaulting to the
 * brand palette: Persian turquoise #0e9c9c with a muted red for Fridays.
 */

.tfc-cal {
	--tfc-accent: #0e9c9c;
	--tfc-holiday: #c0392b;
	--tfc-radius: 14px;
	--tfc-ink: #1e2a32;
	--tfc-muted: #7c8a92;
	--tfc-line: #e4eeee;
	--tfc-soft: #f4f8f8;

	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: 340px;
	margin-inline: auto;
	padding: 14px;
	border: 1px solid var(--tfc-line);
	border-radius: var(--tfc-radius);
	background: #fff;
	color: var(--tfc-ink);
	font-family: inherit;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgba(7, 64, 63, 0.06), 0 8px 24px rgba(7, 64, 63, 0.06);
}

.tfc-cal * {
	box-sizing: border-box;
}

/* ---------- Header ---------- */
.tfc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px;
	margin-block-end: 12px;
	border-radius: calc(var(--tfc-radius) - 6px);
	background: var(--tfc-accent);
	color: #fff;
}

.tfc-title {
	flex: 1;
	text-align: center;
	font-weight: 700;
	font-size: 1.02em;
	white-space: nowrap;
}

.tfc-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 30px;
	block-size: 30px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

/* The chevrons became inline SVG in 3.0.6; the mirrored characters they
 * replaced were flipped by the RTL container. */
.tfc-nav svg {
	inline-size: 17px;
	block-size: 17px;
	display: block;
}

.tfc-nav:hover {
	background: rgba(255, 255, 255, 0.32);
}

.tfc-nav:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

/* Hide nav controls entirely when the shortcode disables navigation. */
.tfc-cal:not(.tfc-has-nav) .tfc-nav {
	display: none;
}

/* ---------- Weekday row + grid ---------- */
.tfc-weekdays,
.tfc-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.tfc-weekdays {
	margin-block-end: 6px;
}

.tfc-wd {
	text-align: center;
	font-size: 0.78em;
	font-weight: 600;
	color: var(--tfc-muted);
	padding-block: 4px;
}

.tfc-wd-holiday {
	color: var(--tfc-holiday);
}

.tfc-cell {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	border-radius: 9px;
	font-size: 0.92em;
	font-variant-numeric: tabular-nums;
}

.tfc-empty {
	visibility: hidden;
}

.tfc-day {
	background: var(--tfc-soft);
	color: var(--tfc-ink);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tfc-day.tfc-holiday {
	color: var(--tfc-holiday);
	background: color-mix(in srgb, var(--tfc-holiday) 8%, #fff);
}

.tfc-day.tfc-today {
	position: relative;
	background: var(--tfc-accent);
	color: #fff;
	font-weight: 700;
	box-shadow: 0 2px 8px color-mix(in srgb, var(--tfc-accent) 45%, transparent);
}

/* Today always wins over the holiday tint when they coincide. */
.tfc-day.tfc-today.tfc-holiday {
	color: #fff;
	background: var(--tfc-accent);
}

.tfc-num {
	display: inline-block;
	line-height: 1;
}

/* Browsers without color-mix() still get a readable fallback. */
@supports not (background: color-mix(in srgb, red 10%, white)) {
	.tfc-day.tfc-holiday {
		background: var(--tfc-soft);
	}
}

@media (prefers-reduced-motion: reduce) {
	.tfc-nav,
	.tfc-day {
		transition: none;
	}
}

/* ---------- Today's-date caption (optional, below the calendar) ---------- */
.tfc-cal-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.tfc-cal-caption {
	--tfc-accent: #0e9c9c;

	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: 340px;
	margin-inline: auto;
	padding: 9px 14px;
	border-radius: calc(var(--tfc-radius, 14px) - 4px);
	background: color-mix(in srgb, var(--tfc-accent) 10%, #fff);
	border: 1px solid color-mix(in srgb, var(--tfc-accent) 22%, transparent);
	color: color-mix(in srgb, var(--tfc-accent) 72%, #000);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 700;
	text-align: center;
	line-height: 1.6;
}
