.sureforecast-table-wrap {
	border-radius: 5px;
	background: #fff;
	position: relative;
}

/* A single overlay owns every outer edge, so collapsed cell borders cannot double it or square its corners. */
.sureforecast-table-wrap::after {
	border: 1px solid var(--sf-border);
	border-radius: 5px;
	box-sizing: border-box;
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
	z-index: 5;
}

.sureforecast-season {
	border-radius: 5px;
	overflow: visible;
}

/* Keep the pollen/month row visible while the visitor reads the calendar. */
.sureforecast-calendar .sureforecast-table-wrap {
	overflow: visible;
}

.sureforecast-calendar .sureforecast-table thead th {
	background: #fff;
	position: sticky;
	top: var(--sureforecast-calendar-sticky-top, 0px);
	z-index: 3;
}

.sureforecast-calendar .sureforecast-table thead th:first-child {
	z-index: 4;
}

/* The overlay supplies the outer edge; table cells only draw internal dividers. */
.sureforecast-calendar .sureforecast-table {
	background: #fff;
	border: 0;
}

.sureforecast-calendar .sureforecast-table tbody tr:last-child > * {
	border-bottom: 0;
}

.sureforecast-calendar .sureforecast-table tr > :first-child {
	border-left: 0;
}

.sureforecast-calendar .sureforecast-table tr > :last-child {
	border-right: 0;
}

/* The narrow layout prioritises reliable horizontal scrolling. */
@media (max-width: 768px) {
	.sureforecast-calendar .sureforecast-table-wrap {
		overflow-x: auto;
	}

	.sureforecast-calendar .sureforecast-table thead th {
		position: static;
	}
}

.sureforecast-season__cell {
	background: #fff !important;
	height: 3.75rem;
	overflow: visible;
	position: relative;
}

.sureforecast-season__marker {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-rows: repeat(3, minmax(0, 1fr));
	gap: 0;
	height: 50px;
	padding: 5px 0;
	/* Cover the two shared cell borders so adjacent active periods form one band. */
	width: calc(100% + 2px);
	margin: 0 -1px;
	position: relative;
	z-index: 1;
}

/* Do not paint into the pollen-name column or beyond the final month. */
.sureforecast-season tbody tr > td:first-of-type .sureforecast-season__marker {
	width: calc(100% + 1px);
	margin-left: 0;
}

.sureforecast-season tbody tr > td:last-child .sureforecast-season__marker {
	width: calc(100% + 1px);
	margin-right: 0;
}

.sureforecast-season__band {
	display: block;
	border-radius: 0;
}

.sureforecast-season__band.period-1 {
	grid-column: 1;
}

.sureforecast-season__band.period-2 {
	grid-column: 2;
}

.sureforecast-season__band.period-3 {
	grid-column: 3;
}

.sureforecast-season__band--low {
	background: var(--sf-season-low);
	grid-row: 3;
}

.sureforecast-season__band--moderate {
	background: var(--sf-season-moderate);
	grid-row: 2;
}

.sureforecast-season__band--high {
	background: var(--sf-season-high);
	grid-row: 1;
}

.sureforecast-season__band.is-start {
	border-radius: 999px 0 0 999px;
}

.sureforecast-season__band.is-end {
	border-radius: 0 999px 999px 0;
}

.sureforecast-season__band.is-start.is-end {
	border-radius: 999px;
}

.sureforecast-season__source {
	margin: .75rem 0 0;
	font-size: .86em;
}

.sureforecast-calendar .sureforecast-table th:first-child {
	padding-left: 10px;
}

.sureforecast-calendar .sureforecast-table tbody th[scope="row"] {
	font-size: 1.1rem;
}

.sureforecast-calendar .sureforecast-season th:first-child {
	width: 13rem;
}

.sureforecast-history-wrap {
	border-radius: 5px;
	background: #fff;
}

.sureforecast-history-wrap .sureforecast-history {
	background: #fff;
	border: 0;
}

.sureforecast-history-wrap .sureforecast-history caption {
	background: #fff;
	border-radius: 4px 4px 0 0;
}

/* Retain the internal divider between the caption and sticky header. */
.sureforecast-history-wrap .sureforecast-history thead tr:first-child > * {
	border-top: 1px solid var(--sf-border);
}

/* Keep the archive disclaimer clear of the archive table and its controls. */
.sureforecast-panel[data-panel="history"]:not([hidden]) ~ .sureforecast-calendar__notice {
	margin-top: 1.25rem;
}

/* Use the active theme's standard WordPress button tokens for calendar tabs. */
.sureforecast-tabs .wp-element-button.sureforecast-tabs__button {
	background: var(--theme-button-background-initial-color, var(--sf-accent)) !important;
	border: var(--theme-button-border, 0) !important;
	border-radius: var(--theme-button-border-radius, 10px) !important;
	box-shadow: var(--theme-button-shadow, none) !important;
	color: var(--theme-button-text-initial-color, #fff) !important;
	font-family: var(--theme-button-font-family, inherit) !important;
	font-size: var(--theme-button-font-size, inherit) !important;
	font-weight: var(--theme-button-font-weight, inherit) !important;
	line-height: normal;
	min-height: var(--theme-button-min-height, auto);
	padding: var(--theme-button-padding, .5rem .9rem) !important;
	text-transform: var(--theme-button-transform, none);
}

.sureforecast-tabs .wp-element-button.sureforecast-tabs__button[aria-selected="false"] {
	background: transparent !important;
	box-shadow: inset 0 0 0 2px var(--theme-button-background-initial-color, var(--sf-accent)) !important;
	color: var(--theme-button-background-initial-color, var(--sf-accent)) !important;
}

.sureforecast-tabs .wp-element-button.sureforecast-tabs__button:hover,
.sureforecast-tabs .wp-element-button.sureforecast-tabs__button:focus-visible {
	background: var(--theme-button-background-hover-color, var(--theme-button-background-initial-color, var(--sf-accent))) !important;
	box-shadow: none !important;
	color: var(--theme-button-text-hover-color, #fff) !important;
}
