/**
 * Travel26 Climate Chart
 *
 * Contents
 * 1. Variables and box
 * 2. Title and key
 * 3. Plot: scale lines, bars, values, months
 * 4. Lollipop style
 * 5. Legend
 * 6. Editor hint
 * 7. Responsive
 *
 * Colours read the Inoforest Core Design System when it is active, with the Travel26 design as fallback. The season
 * colours match the Season List widget's defaults.
 */

/* 1. Variables and box ---------------------------------------------------------- */
.travel26-climate {
	--travel26-climate-height: 230px;
	--travel26-climate-border: var(--inoforest-color-border, #e5ebef);
	--travel26-climate-label: #8b99a6;
	--travel26-season-best: var(--inoforest-color-primary, #0b7a75);
	--travel26-season-shoulder: #ffb422;
	--travel26-season-wet: #a9bccb;
	margin: 0;
	padding: 30px 32px 26px;
	background: #fff;
	border: 1px solid var(--travel26-climate-border);
	border-radius: 24px;
	box-shadow: 0 6px 20px rgba(13, 27, 42, 0.07);
}

/* 2. Title and key ----------------------------------------------------------------- */
.travel26-climate .travel26-climate__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 6px 20px;
	margin-bottom: 10px;
}

.travel26-climate .travel26-climate__title {
	margin: 0;
	font-size: 1.15rem;
	color: var(--inoforest-color-heading, #0d1b2a);
}

.travel26-climate .travel26-climate__key {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--travel26-climate-label);
}

.travel26-climate .travel26-climate__key svg {
	width: 1em;
	height: 1em;
	fill: var(--travel26-season-best);
}

/* 3. Plot: scale lines, bars, values, months ------------------------------------------ */
.travel26-climate .travel26-climate__plot {
	position: relative;
	padding: 34px 0 34px 36px;
}

.travel26-climate[data-grid="false"] .travel26-climate__plot {
	padding-left: 0;
}

.travel26-climate .travel26-climate__grid {
	position: absolute;
	top: 34px;
	right: 0;
	bottom: 34px;
	left: 36px;
}

.travel26-climate .travel26-climate__grid span {
	position: absolute;
	right: 0;
	bottom: var(--y);
	left: 0;
	border-top: 1px dashed var(--travel26-climate-border);
}

.travel26-climate .travel26-climate__grid span:first-child {
	border-top-style: solid;
	border-color: #cfd8de;
}

.travel26-climate .travel26-climate__grid span::before {
	position: absolute;
	top: -9px;
	left: -36px;
	width: 28px;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: end;
	color: var(--travel26-climate-label);
	content: attr(data-label);
}

.travel26-climate .travel26-climate__bars {
	position: relative;
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 8px;
	height: var(--travel26-climate-height);
	margin: 0;
	padding: 0;
	list-style: none;
}

.travel26-climate .travel26-climate__month {
	--travel26-season: var(--travel26-season-best);
	position: relative;
	height: 100%;
	margin: 0;
}

.travel26-climate .travel26-climate__month.is-shoulder {
	--travel26-season: var(--travel26-season-shoulder);
}

.travel26-climate .travel26-climate__month.is-wet,
.travel26-climate .travel26-climate__month.is-none {
	--travel26-season: var(--travel26-season-wet);
}

.travel26-climate .travel26-climate__bar {
	position: absolute;
	bottom: 0;
	left: 50%;
	width: min(100%, 30px);
	height: var(--h);
	min-height: 4px;
	background: var(--travel26-season);
	border-radius: 8px 8px 3px 3px;
	transform: translateX(-50%);
	transition: filter 0.35s ease;
}

.travel26-climate .travel26-climate__month:hover .travel26-climate__bar {
	filter: brightness(0.9);
}

.travel26-climate .travel26-climate__value {
	position: absolute;
	right: 0;
	bottom: calc(var(--h) + 6px);
	left: 0;
	font-size: 0.72rem;
	font-weight: 800;
	line-height: 1;
	text-align: center;
	color: var(--inoforest-color-heading, #0d1b2a);
}

.travel26-climate .travel26-climate__name {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	left: 0;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	color: var(--travel26-climate-label);
}

.travel26-climate .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* 4. Lollipop style ------------------------------------------------------------------- */
.travel26-climate[data-chart-type="lollipop"] .travel26-climate__bar {
	width: 4px;
	border-radius: 4px;
}

.travel26-climate[data-chart-type="lollipop"] .travel26-climate__bar::before {
	position: absolute;
	top: 0;
	left: 50%;
	width: 16px;
	height: 16px;
	content: "";
	background: var(--travel26-season);
	border-radius: 50%;
	box-shadow: 0 0 0 3px #fff;
	transform: translate(-50%, -50%);
}

.travel26-climate[data-chart-type="lollipop"] .travel26-climate__value {
	bottom: calc(var(--h) + 16px);
}

/* 5. Legend ------------------------------------------------------------------------------ */
.travel26-climate .travel26-climate__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 22px;
	margin: 0;
	padding: 18px 0 0;
	list-style: none;
	border-top: 1px solid var(--travel26-climate-border);
}

.travel26-climate .travel26-climate__legend li {
	--travel26-season: var(--travel26-season-best);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--inoforest-color-heading, #0d1b2a);
}

.travel26-climate .travel26-climate__legend .is-shoulder {
	--travel26-season: var(--travel26-season-shoulder);
}

.travel26-climate .travel26-climate__legend .is-wet {
	--travel26-season: var(--travel26-season-wet);
}

.travel26-climate .travel26-climate__legend li::before {
	width: 12px;
	height: 12px;
	content: "";
	background: var(--travel26-season);
	border-radius: 3px;
}

/* 6. Editor hint ------------------------------------------------------------------- */
.travel26-climate__empty {
	margin: 0 0 12px;
	padding: 14px 18px;
	font-size: 13px;
	text-align: center;
	border: 1px dashed var(--inoforest-color-border, #e5ebef);
	border-radius: 12px;
}

/* 7. Responsive -------------------------------------------------------------------- */
@media (max-width: 767px) {
	.travel26-climate {
		--travel26-climate-height: 200px;
		padding: 22px 16px 18px;
	}

	.travel26-climate .travel26-climate__plot {
		padding-left: 0;
	}

	.travel26-climate .travel26-climate__grid {
		left: 0;
	}

	.travel26-climate .travel26-climate__grid span::before {
		display: none;
	}

	.travel26-climate .travel26-climate__bars {
		gap: 4px;
	}

	.travel26-climate .travel26-climate__value {
		font-size: 0.62rem;
	}

	.travel26-climate .travel26-climate__name {
		font-size: 0.65rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.travel26-climate .travel26-climate__bar {
		transition: none;
	}
}
