@font-face {
	font-family: 'Work Sans';
	src: url('assets/WorkSans-Light.woff2') format('woff2'),
	url('assets/WorkSans-Light.woff') format('woff');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Work Sans';
	src: url('assets/WorkSans-SemiBold.woff2') format('woff2'),
	url('assets/WorkSans-SemiBold.woff') format('woff');
	font-weight: bold;
	font-style: normal;
	font-display: swap;
}

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

h1, h2, h3, h4, p, ul, body, margin, ul, ol {
	margin: 0;
	padding: 0;
}

html {
	font-family: 'Work Sans', sans-serif;
	overflow-x: hidden;
}

body {
	--page-background: #fff;
	--default-text-color: #000;
	--secondary-text-color: #444;
	--showpiece-background: #fefefe;
	--form-field-background: #fefefe;
	--button-text-color-highlight: #bc5801;
	--secondary-background: #f6f6f6;
	--secondary-background-active: #f5e7df;

	--drop-shadow-color: rgba(0, 0, 0, 0.05);
	--inner-shadow-color: rgba(0, 0, 0, 0.1);
	--grid-line-color: #ddd;

	background: var(--page-background);
	color: var(--default-text-color);
}

@media (prefers-color-scheme: dark) {
	body {
		--page-background: #000;
		--default-text-color: #fff;
		--secondary-text-color: #ccc;
		--showpiece-background: #444;
		--secondary-background: #333;
		--secondary-background-active: #5a170d;
		--button-text-color-highlight: #f87f17;
		--grid-line-color: #777;
	}
}

table {
	border-collapse: collapse;
}

h1, h2, h3, h4, th, button, input, select {
	font: inherit;
}

summary, li {
	list-style: none;
}

input, button, select {
	color: inherit;
}

button, label, select, summary {
	cursor: pointer;
}

button {
	display: inline-flex;
	align-items: center;
	gap: 0.2em;
	transition: color 0.3s;
}

button:is(:hover, :focus-visible) {
	color: var(--button-text-color-highlight);
}

.alt-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

x-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.icon {
	display: inline-block;
	width: 1em;
	aspect-ratio: 1;
}

body > header {
	padding: 0.4em 1em;
	background: black;
	color: white;
}

header h1 {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;

	font-size: 120%;
	font-weight: bold;
	text-transform: uppercase;
}

header h1 x-icon {
	display: flex;
	align-items: center;
	font-size: 200%;
}

.place-search-form {
	max-width: 40em;
	padding: 3em;
	display: flex;
	flex-direction: column;
	gap: 1em;
	align-items: center;
	margin: 0 auto;
}

x-search-input {
	width: 100%;
}

.place-search-form .search-field {
	display: flex;
	align-items: center;
	padding: 0.5em;
	gap: 0.5em;

	font-size: 120%;
	border-radius: 0.3em;
	background: var(--showpiece-background);
	box-shadow: inset 0 -2em 5em rgba(0, 0, 0, 0.1);
}

x-place-list {
	width: 100%;
}

.place-list:not(:empty) {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	width: 100%;
}

.place-list .place {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
	padding: 1em;

	background: var(--secondary-background);
	border-radius: 0.3em;
	cursor: pointer;
	transition: background 0.3s;
}

.place-list .place:is(:hover, :focus-visible, [aria-selected]) {
	background: var(--secondary-background-active);
}

.place-list .place .name {
	flex: 1;
	width: 100%;
}

.place-list .place .recent:not([hidden]) {
	display: flex;
	align-items: center;
	justify-content: center;
}

.search-field x-icon {
	font-size: 150%;
	flex: none;
}

.search-field input {
	flex: 1;
	width: 100%;
	padding: 0.3em;

	border-radius: 0.2em;
	border: 0;
	background: var(--form-field-background);
	color: #000;
}

.place-header {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	padding: 1em;

	text-align: center;
	background: var(--secondary-background);
	text-transform: uppercase;
}

.place-header button[value="edit-place"] {
	border: 0;
	background: transparent;
}

x-forecast-list {
	display: flex;
	flex-direction: column;
	gap: 2em;
	padding: 2em 0;
}

.daily-forecast {
	max-width: 60em;
	width: calc(100% - max(1em, 6vw));
	margin: 0 auto;
	overflow: hidden;

	border-radius: 0.6em;
	background: var(--showpiece-background);
	box-shadow: 0 0.2em 0.4em var(--drop-shadow-color),
	inset 0 -2em 5em var(--inner-shadow-color);
}

.forecast-header {
	display: flex;
	gap: 2em;
	justify-content: space-between;
	padding: 1em;

	background-image: linear-gradient(to top, var(--drop-shadow-color), transparent 0.5em);
}

.forecast-header h3 {
	font-weight: bold;
	text-align: center;
	text-transform: uppercase;
	color: var(--secondary-text-color);
}

.forecast-header .show-table {
	border: 0;
	background: transparent;
}

.graph {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 1em;
	padding: 3em 1em 2em;
}

.graph .bar {
	--bar-offset: 2em;
	display: flex;
	align-items: center;
	gap: 0.5em;
	z-index: 1;
}

.graph .icon {
	display: flex;
	align-items: center;
	flex: none;
	font-size: 150%;
}

.graph .bar::after {
	content: '';
	display: block;
	flex: 1;
	min-height: 2em;

	border-radius: 1em;
	box-shadow: inset 0.1em 0.1em 0.3em rgba(0, 0, 0, 0.3);
	background-image: linear-gradient(90deg, var(--heatmap));
}

.graph :is(.dusk, .dawn) {
	position: absolute;
	left: calc(var(--bar-offset) + (100% - var(--bar-offset)) * var(--position));
	transform: translateX(-50%);
}

.graph .grid-lines {
	position: absolute;
	top: 1em;
	left: 3em;
	right: 1em;
	bottom: 0;
	display: flex;
	justify-content: space-between;
}

.graph .grid-lines div {
	width: 0;
	text-indent: -50%;
}

.graph .grid-lines div:not(:first-child):not(:last-child)::before {
	content: '';
	display: block;
	position: absolute;
	top: 1.4em;
	bottom: 0;
	border-left: 0.1em dotted var(--grid-line-color);
}

.graph .grid-lines span {
	display: inline-block;
}

@media (width < 34em) {
	.graph .grid-lines > :nth-child(2n) {
		opacity: 0;
	}
}

@media (width < 20em) {
	.graph .grid-lines > :nth-child(4n+1) {
		opacity: 0;
	}
}

.table-view[open] {
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;

	border: 0;
	border-radius: 0.6em;
	background: var(--showpiece-background);
	box-shadow: 0 1em 2em rgba(0, 0, 0, 0.3);
	color: inherit;
}

.table-view header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1em;

	background: var(--showpiece-background);
	background-image: linear-gradient(to top, var(--inner-shadow-color), transparent 0.5em);
	color: var(--secondary-text-color);
}

.table-view .content {
	display: flex;
	flex-direction: column;
	padding: 1em;
	min-height: 0;
	max-height: 100%;
}

.table-view .table-scroll {
	max-width: 100%;
	min-height: 0;
	max-height: 100%;
	overflow: auto;
}

.table-view h2 {
	display: flex;
	align-items: center;
	gap: 0.5em;
	flex-wrap: wrap;
}

.table-view button[value=close] {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.2em;
	aspect-ratio: 1;

	border: 0;
	background: none;
}

.forecast-table {
	margin: 0 auto;
	font-size: 87.5%;
}

.forecast-table :is(th, td) {
	padding: 0.2em 0.5em;
	border-top: 0.1em solid #ddd;
	border-bottom: 0.1em solid #ddd;
	white-space: nowrap;
}

.forecast-table :is(th, td) {
	text-align: left;
}

.forecast-table :is(th, td):not(:nth-child(1), :nth-child(2)) {
	text-align: right;
}

.forecast-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;

	vertical-align: bottom;
	font-weight: bold;
	font-size: 75%;
	text-transform: uppercase;
	background: var(--showpiece-background);
}

.forecast-table :is(th, td):first-child {
	position: sticky;
	left: 0;
	z-index: 2;
	background: var(--showpiece-background);
}

.forecast-table thead th:first-child {
	z-index: 3;
}

.forecast-table thead x-icon {
	display: block;
	font-size: 150%;
}

.forecast-table td[style] {
	background-color: var(--background);
}

.forecast-table .time:not([data-day]) {
	background: black;
	color: white;
}

.forecast-table .time[data-day] {
	background: #6fd5f1;
	color: black;
}

.forecast-table .wind-direction-icon > svg {
	transform: rotate(calc(var(--direction) * 1deg));
}

.forecast-table tbody td:not(:nth-child(2)):not(:nth-child(7)) {
	color: black;
}