/* iCal Calendar Display – inherits your theme's fonts and text color.
   Change the accent by setting --icd-accent in your theme's CSS, e.g.
   .icd { --icd-accent: #0f766e; } */

.icd {
	--icd-accent: #1d4ed8;
	--icd-accent-text: #fff;
	--icd-line: rgba(128, 128, 128, 0.28);
	--icd-soft: rgba(128, 128, 128, 0.1);
	--icd-radius: 8px;
	margin: 1.5em 0;
	color: inherit;
	font: inherit;
}
.icd *,
.icd *::before,
.icd *::after { box-sizing: border-box; }

.icd-heading { margin: 0 0 0.75em; }
.icd-empty { margin: 0 0 1em; opacity: 0.75; }

.icd-notice {
	padding: 0.75rem 1rem;
	border: 1px dashed var(--icd-line);
	border-radius: var(--icd-radius);
	font-size: 0.9em;
}

/* ---------- List view ---------- */

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

.icd-event {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 1rem 0;
	border-top: 1px solid var(--icd-line);
}
.icd-event:first-child { border-top: 0; padding-top: 0; }

.icd-badge {
	flex: 0 0 3.5rem;
	align-self: flex-start;
	text-align: center;
	line-height: 1.1;
	border: 1px solid var(--icd-line);
	border-radius: var(--icd-radius);
	overflow: hidden;
}
.icd-badge-month {
	display: block;
	padding: 0.25rem 0;
	background: var(--icd-accent);
	color: var(--icd-accent-text);
	font-size: 0.75rem;
	font-weight: 600;
}
.icd-badge-day { display: block; padding: 0.3rem 0 0.35rem; font-size: 1.4rem; font-weight: 700; }

.icd-body { flex: 1; min-width: 0; }
.icd-body p { margin: 0; }
.icd-summary { font-weight: 600; font-size: 1.05em; line-height: 1.35; }
.icd-summary a { color: inherit; text-underline-offset: 2px; }
.icd-when,
.icd-location { margin-top: 0.15rem; font-size: 0.9em; opacity: 0.8; }
.icd-desc { margin-top: 0.5rem; font-size: 0.92em; overflow-wrap: anywhere; }
.icd-desc p { margin: 0 0 0.5em; }

/* ---------- Month view ---------- */

.icd-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}
.icd-month-title { margin: 0; font-size: 1.25em; }
.icd-nav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--icd-line);
	border-radius: 50%;
	color: inherit;
	font-size: 1.3rem;
	line-height: 1;
	text-decoration: none;
}
.icd-nav-btn:hover { background: var(--icd-soft); }
.icd-nav-btn:focus-visible { outline: 2px solid var(--icd-accent); outline-offset: 2px; }

.icd-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	border: 1px solid var(--icd-line);
	border-radius: var(--icd-radius);
	overflow: hidden;
}
.icd-weekday {
	padding: 0.5rem 0.25rem;
	border-bottom: 1px solid var(--icd-line);
	text-align: center;
	font-size: 0.8rem;
	font-weight: 600;
	opacity: 0.7;
}
.icd-cell {
	min-height: 6.5rem;
	padding: 0.3rem;
	border-right: 1px solid var(--icd-line);
	border-bottom: 1px solid var(--icd-line);
}
.icd-grid > :nth-child(7n) { border-right: 0; }
.icd-grid > .icd-cell:nth-last-child(-n + 7) { border-bottom: 0; }
.icd-other { background: var(--icd-soft); }
.icd-other .icd-daynum { opacity: 0.45; }

.icd-daynum {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	font-size: 0.85rem;
	font-weight: 600;
}
.icd-today .icd-daynum { border-radius: 50%; background: var(--icd-accent); color: var(--icd-accent-text); }
.icd-cell-date { display: none; }

.icd-cell-events { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.icd-chip {
	margin: 0 0 0.2rem;
	padding: 0.15rem 0.35rem;
	border-left: 3px solid var(--icd-accent);
	border-radius: 3px;
	background: rgba(29, 78, 216, 0.1);
	background: color-mix(in srgb, var(--icd-accent) 12%, transparent);
	font-size: 0.75rem;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.icd-chip.icd-allday { background: var(--icd-accent); color: var(--icd-accent-text); }
.icd-chip a { color: inherit; text-decoration: none; }
.icd-chip a:hover { text-decoration: underline; }
.icd-chip-time { margin-right: 0.25rem; font-weight: 600; }

/* Phones: the month turns into an agenda of days that have events. */
@media (max-width: 640px) {
	.icd-grid { display: block; border: 0; border-radius: 0; }
	.icd-weekday,
	.icd-cell:not(.icd-has-events),
	.icd-cell.icd-other { display: none; }
	.icd-cell {
		display: flex;
		gap: 0.75rem;
		min-height: 0;
		padding: 0.75rem 0;
		border: 0;
		border-top: 1px solid var(--icd-line);
		background: none;
	}
	.icd-daynum { display: none; }
	.icd-cell-date { display: block; flex: 0 0 5.5rem; font-weight: 600; font-size: 0.9rem; }
	.icd-today .icd-cell-date { color: var(--icd-accent); }
	.icd-cell-events { flex: 1; min-width: 0; margin: 0; }
	.icd-chip { padding: 0.35rem 0.5rem; font-size: 0.9rem; white-space: normal; }
}
