/**
 * Weer widget - front end styles.
 *
 * Everything is scoped under .weer-w and resets the properties themes most
 * often change (fonts, image borders, link underlines, margins), so the widget
 * looks the same in classic themes, block themes and page builders.
 */

.weer-w {
	--weer-radius: 22px;
	--weer-gap: 16px;
	--weer-pad: 20px;
	--weer-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 0 1.5em;
	padding: 0;
	border: 0;
	font-family: var(--weer-font);
	font-size: 15px;
	line-height: 1.35;
	text-align: left;
	color: #0f172a;
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
	/* Never let the widget's content push its column wider than its neighbours. */
	contain: inline-size;
}

/* Floated blocks have no width of their own. */
.wp-block-weer-forecast.alignleft,
.wp-block-weer-forecast.alignright,
.wp-block-weer-forecast.aligncenter {
	width: 340px;
	max-width: 100%;
}

.wp-block-weer-forecast.aligncenter {
	margin-left: auto;
	margin-right: auto;
}

.weer-w *,
.weer-w *::before,
.weer-w *::after {
	box-sizing: border-box;
}

.weer-w.weer-w--tight {
	/* !important: themes such as Twenty Twenty-One size every direct child of
	   the content area with very specific selectors. */
	max-width: 360px !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

.weer-w img {
	display: block;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: none;
}

.weer-w a,
.weer-w a:hover,
.weer-w a:focus {
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	border: 0;
}

.weer-w p {
	margin: 0;
}

/* ---------- card ---------- */

.weer-w__card {
	--weer-bg: linear-gradient(160deg, #2f6fde 0%, #5aa2f0 100%);
	--weer-fg: #ffffff;

	position: relative;
	overflow: hidden;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	gap: var(--weer-gap);
	padding: var(--weer-pad);
	border-radius: var(--weer-radius);
	background: var(--weer-bg);
	color: var(--weer-fg);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 12px 32px -12px rgba(15, 23, 42, .35);
}

/* Soft light blobs give depth to the coloured themes. */
.weer-w__card::before,
.weer-w__card::after {
	content: "";
	position: absolute;
	z-index: -1;
	border-radius: 50%;
	pointer-events: none;
}

.weer-w__card::before {
	width: 260px;
	height: 260px;
	top: -120px;
	right: -90px;
	background: radial-gradient(closest-side, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
}

.weer-w__card::after {
	width: 220px;
	height: 220px;
	bottom: -120px;
	left: -80px;
	background: radial-gradient(closest-side, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0));
}

/* Auto theme: colours follow the weather. */
.weer-w__card--frost { --weer-bg: linear-gradient(160deg, #4a6fd6 0%, #8db4f6 100%); }
.weer-w__card--cool  { --weer-bg: linear-gradient(160deg, #2563d6 0%, #4fa3ee 100%); }
.weer-w__card--mild  { --weer-bg: linear-gradient(160deg, #0f7fc4 0%, #2bb9a9 100%); }
.weer-w__card--warm  { --weer-bg: linear-gradient(160deg, #e0632f 0%, #eea53a 100%); }
.weer-w__card--hot   { --weer-bg: linear-gradient(160deg, #d63c4a 0%, #ec8a3c 100%); }
.weer-w__card--rain  { --weer-bg: linear-gradient(160deg, #3b4a6b 0%, #6d84ab 100%); }

.weer-w__card--light {
	--weer-glass: rgba(15, 23, 42, .045);
	--weer-line: rgba(15, 23, 42, .1);
	box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 12px 32px -16px rgba(15, 23, 42, .25);
}

.weer-w__card--light::before {
	background: radial-gradient(closest-side, rgba(79, 163, 238, .18), rgba(79, 163, 238, 0));
}

.weer-w__card--light::after,
.weer-w__card--dark::after {
	display: none;
}

.weer-w__card--dark::before {
	background: radial-gradient(closest-side, rgba(99, 102, 241, .35), rgba(99, 102, 241, 0));
}

.weer-w__card--custom::before {
	background: radial-gradient(closest-side, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
}

.weer-w__card {
	--weer-glass: rgba(255, 255, 255, .14);
	--weer-line: rgba(255, 255, 255, .22);
}

.weer-w__card--light {
	--weer-glass: rgba(15, 23, 42, .045);
	--weer-line: rgba(15, 23, 42, .1);
}

/* The provider's dark icons are a light grey; give them more contrast on white. */
.weer-w .weer-w__card--light img {
	filter: brightness(.55);
}

/* ---------- header ---------- */

.weer-w__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}

.weer-w .weer-w__place {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .01em;
}

.weer-w .weer-w__place:hover .weer-w__title,
.weer-w .weer-w__place:focus-visible .weer-w__title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.weer-w .weer-w__place:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 6px;
}

.weer-w__title {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.weer-w__date {
	flex: none;
	font-size: 13px;
	opacity: .78;
	white-space: nowrap;
}

/* ---------- icons ---------- */

.weer-w__svg {
	display: inline-flex;
	flex: none;
	width: 18px;
	height: 18px;
}

.weer-w__svg svg {
	width: 100%;
	height: 100%;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.weer-w__pin {
	width: 16px;
	height: 16px;
}

/* ---------- hero ---------- */

.weer-w__hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.weer-w__now {
	min-width: 0;
}

.weer-w__temp {
	display: flex;
	align-items: flex-start;
	font-size: 64px;
	font-weight: 300;
	line-height: 1;
	letter-spacing: -.04em;
}

.weer-w__deg {
	margin: 6px 0 0 4px;
	font-size: 20px;
	font-weight: 500;
	letter-spacing: 0;
	opacity: .85;
}

.weer-w__desc {
	margin-top: 8px;
	font-size: 16px;
	font-weight: 500;
}

.weer-w__hilo {
	display: flex;
	gap: 12px;
	margin-top: 4px;
	font-size: 14px;
	opacity: .82;
	font-variant-numeric: tabular-nums;
}

.weer-w .weer-w__icon {
	flex: none;
	width: 96px;
	height: 96px;
	object-fit: contain;
	filter: drop-shadow(0 8px 16px rgba(15, 23, 42, .18));
	animation: weer-float 6s ease-in-out infinite;
}

@keyframes weer-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}

/* ---------- stats ---------- */

.weer-w__stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.weer-w__stat {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--weer-glass);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.weer-w__stat .weer-w__svg {
	opacity: .85;
}

.weer-w__stat-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.weer-w__stat-value {
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.weer-w__stat-label {
	font-size: 12px;
	opacity: .75;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- sun ---------- */

.weer-w__sun {
	padding: 12px 14px 10px;
	border-radius: 16px;
	background: var(--weer-glass);
}

.weer-w__arc {
	height: 46px;
	margin: 0 6px 6px;
}

.weer-w__arc svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.weer-w__arc-track {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-dasharray: 3 5;
	opacity: .6;
	vector-effect: non-scaling-stroke;
}

.weer-w__arc-horizon {
	stroke: currentColor;
	stroke-width: 1;
	opacity: .25;
	vector-effect: non-scaling-stroke;
}

.weer-w__arc-sun {
	fill: #ffd54a;
	stroke: rgba(255, 213, 74, .35);
	stroke-width: 8;
	vector-effect: non-scaling-stroke;
}

.weer-w__sun-row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: end;
	gap: 8px;
}

.weer-w__sun-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-width: 0;
}

.weer-w__sun-item .weer-w__svg {
	width: 16px;
	height: 16px;
	opacity: .8;
}

.weer-w__sun-item--mid {
	align-items: center;
	text-align: center;
}

.weer-w__sun-item--end {
	align-items: flex-end;
	text-align: right;
}

.weer-w__sun-time {
	font-size: 15px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.weer-w__sun-label {
	font-size: 12px;
	opacity: .75;
	white-space: nowrap;
}

/* ---------- daily forecast ---------- */

.weer-w__days {
	display: flex;
	flex-direction: column;
	padding: 4px 14px;
	border-radius: 16px;
	background: var(--weer-glass);
}

.weer-w__day {
	display: grid;
	grid-template-columns: 3.4em 32px 2.6em minmax(40px, 1fr) 2.6em;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	font-variant-numeric: tabular-nums;
}

.weer-w__day + .weer-w__day {
	border-top: 1px solid var(--weer-line);
}

.weer-w__day-name {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.weer-w .weer-w__day-icon {
	width: 32px;
	height: 32px;
	object-fit: contain;
}

.weer-w__day-min {
	text-align: right;
	opacity: .72;
}

.weer-w__day-max {
	font-weight: 600;
}

.weer-w__bar {
	position: relative;
	display: block;
	height: 6px;
	border-radius: 3px;
	background: var(--weer-line);
	overflow: hidden;
}

.weer-w__bar-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	border-radius: 3px;
	background-image: linear-gradient(90deg, #7cc4ff 0%, #a8e6cf 35%, #ffd76a 65%, #ff8a65 100%);
	background-repeat: no-repeat;
}

/* ---------- credit ---------- */

.weer-w__credit {
	margin-top: 8px;
	font-size: 12px;
	text-align: center;
	color: inherit;
	opacity: .6;
}

.weer-w .weer-w__credit a {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- loading / error ---------- */

.weer-w__card--loading {
	min-height: 260px;
	--weer-bg: linear-gradient(160deg, #dbe6f6 0%, #eef3fb 100%);
	box-shadow: none;
}

.weer-w__card--loading::before,
.weer-w__card--loading::after {
	display: none;
}

.weer-w__skeleton {
	border-radius: 10px;
	background: linear-gradient(90deg, rgba(255, 255, 255, .45) 0%, rgba(255, 255, 255, .9) 50%, rgba(255, 255, 255, .45) 100%);
	background-size: 200% 100%;
	animation: weer-shimmer 1.4s linear infinite;
}

.weer-w__skeleton--title { height: 18px; width: 55%; }
.weer-w__skeleton--hero  { height: 96px; }
.weer-w__skeleton--row   { height: 64px; }

@keyframes weer-shimmer {
	from { background-position: 200% 0; }
	to { background-position: -200% 0; }
}

.weer-w__noscript {
	font-weight: 600;
	color: #0f172a;
}

.weer-w__card--error {
	--weer-bg: #f1f5f9;
	--weer-fg: #0f172a;
	align-items: flex-start;
	box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
}

.weer-w__card--error::before,
.weer-w__card--error::after {
	display: none;
}

.weer-w .weer-w__retry {
	margin: 0;
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: #0f172a;
	color: #ffffff;
	font: 600 13px/1 var(--weer-font);
	cursor: pointer;
}

.weer-w__card--in {
	animation: weer-in .45s ease-out both;
}

@keyframes weer-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* ---------- sizes ---------- */

/* Typical sidebars and columns (250-330px) */
.weer-w--sm {
	--weer-pad: 16px;
	--weer-gap: 12px;
}

.weer-w--sm .weer-w__date,
.weer-w--sm .weer-w__sun-item--mid {
	display: none;
}

.weer-w--sm .weer-w__sun-row {
	grid-template-columns: 1fr 1fr;
}

.weer-w--sm .weer-w__stats {
	gap: 6px;
}

.weer-w--sm .weer-w__stat {
	padding: 9px 10px;
}

.weer-w--sm .weer-w__stat-label {
	font-size: 11px;
}

.weer-w--sm .weer-w__day {
	grid-template-columns: 2.8em 30px 2.4em minmax(30px, 1fr) 2.4em;
	gap: 8px;
}

/* Very narrow sidebars */
.weer-w--xs {
	--weer-pad: 14px;
	--weer-gap: 12px;
}

.weer-w--xs .weer-w__date {
	display: none;
}

.weer-w--xs .weer-w__temp {
	font-size: 48px;
}

.weer-w--xs .weer-w__icon {
	width: 64px;
	height: 64px;
}

.weer-w--xs .weer-w__stats {
	grid-template-columns: 1fr;
}

.weer-w--xs .weer-w__stat {
	flex-direction: row;
	align-items: center;
	padding: 8px 10px;
}

.weer-w--xs .weer-w__stat-text {
	flex-direction: row-reverse;
	justify-content: space-between;
	flex: 1;
	gap: 6px;
}

.weer-w--xs .weer-w__sun-item--mid {
	display: none;
}

.weer-w--xs .weer-w__sun-row {
	grid-template-columns: 1fr 1fr;
}

.weer-w--xs .weer-w__days {
	padding: 2px 10px;
}

.weer-w--xs .weer-w__day {
	grid-template-columns: 1fr 28px 2.4em 2.4em;
	gap: 6px;
}

.weer-w--xs .weer-w__bar {
	display: none;
}

.weer-w--xs .weer-w__day-icon {
	width: 28px;
	height: 28px;
}

/* Wide areas: content, footer, full-width blocks */
.weer-w--lg {
	--weer-pad: 28px;
	--weer-gap: 18px;
}

.weer-w--lg .weer-w__card {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	column-gap: 28px;
	align-items: start;
}

.weer-w--lg .weer-w__head,
.weer-w--lg .weer-w__days {
	grid-column: 1 / -1;
}

.weer-w--lg .weer-w__hero {
	grid-column: 1;
	grid-row: 2 / span 2;
	align-self: center;
}

.weer-w--lg .weer-w__stats,
.weer-w--lg .weer-w__sun {
	grid-column: 2;
}

.weer-w--lg .weer-w__temp {
	font-size: 88px;
}

.weer-w--lg .weer-w__icon {
	width: 128px;
	height: 128px;
}

.weer-w--lg .weer-w__days {
	flex-direction: row;
	padding: 6px;
}

.weer-w--lg .weer-w__day {
	flex: 1 1 0;
	grid-template-columns: 1fr;
	justify-items: center;
	gap: 6px;
	padding: 12px 4px;
	text-align: center;
}

.weer-w--lg .weer-w__day + .weer-w__day {
	border-top: 0;
	border-left: 1px solid var(--weer-line);
}

.weer-w--lg .weer-w__day-min {
	order: 5;
	text-align: center;
}

.weer-w--lg .weer-w__day-max {
	order: 3;
}

.weer-w--lg .weer-w__bar {
	order: 4;
	width: 70%;
}

.weer-w--lg .weer-w__day-icon {
	width: 40px;
	height: 40px;
}

/* Only the hero (no stats or sun): keep it in one column. */
.weer-w--lg .weer-w__card:not(:has(.weer-w__stats)):not(:has(.weer-w__sun)) {
	grid-template-columns: 1fr;
}

/* ---------- accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
	.weer-w .weer-w__icon,
	.weer-w__skeleton,
	.weer-w__card--in {
		animation: none;
	}
}

@media print {
	.weer-w__card {
		box-shadow: none;
		border: 1px solid #cbd5e1;
	}
}
