@keyframes loading {
    0% {
        -webkit-transform: scale(0);
        transform: scale(0)
    }

    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
        opacity: 0
    }
}

:root {
	--main-color: hsla(215, 45%, 50%, 1);
	--border-color: hsl(0, 0%, 80%);
	--background-color: white;
	--faded-text-color: hsla(0, 0%, 45%, 1);
	--big-font-size: 1rem;
	--normal-font-size: 0.9rem;
	--small-font-size: 0.8rem;
	--thin-border: 1px solid var(--border-color);
	--shadow: 0px 2px 3px 2px #dad9d9;
	--border-radius: 4px;
	--header-size: 45px;
	--horizontal-padding: 40px;
	--vertical-padding: 20px;
	--podcast-list-column-gap: 30px;
	--podcast-list-row-gap: 50px;
}

* {
	box-sizing: border-box;
}

html,
body {
	font-family: Helvetica Neue, Arial;
	min-height: 100%;
	height: 100%;
	width: 100%;
	margin: 0;
}

a {
	color: var(--main-color);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

h1 {
	border-bottom: var(--thin-border);
	font-size: var(--big-font-size);
	margin-bottom: 0;
	padding-bottom: 15px;
	position: relative;
}

h2 {
	font-size: var(--normal-font-size);
}

main {
	min-height: 100%;
	margin: var(--header-size) auto;
	padding: var(--vertical-padding) var(--horizontal-padding);
	width: 100%;
}

main > header {
	background: var(--background-color);
	height: var(--header-size);
	left: 0;
	padding: 0 var(--horizontal-padding);
	position: fixed;
	top: 0;
	width: 100%;
	z-index: 100;
}

section {
	display: none;
	transition: opacity 200ms ease-in-out;
}

section.visible {
	display: block;
}

/* --- Form styles --- */

form {
	margin-bottom: 10px;
	text-align: right;
}

label > span {
	display: none;
}

input[type="search"] {
	background: none;
	border: var(--thin-border);
	border-radius: var(--border-radius);
	box-shadow: inset 0px 1px 2px 0px hsl(0, 0%, 83%);
	font-size: var(--small-font-size);
	padding: 8px;
	width: 220px;
}

#search-count {
	background-color: var(--main-color);
	border-radius: 5px;
	color: white;
	padding: 2px 8px;
	font-size: var(--small-font-size);
	margin-right: 4px;
}



/* --- Podcast list styles --- */

.podcast-list {
	display: grid;
	grid-column-gap: var(--podcast-list-column-gap);
	grid-row-gap: var(--podcast-list-row-gap);
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	list-style-type: none;
	margin: 0;
	padding: 0;
}

.podcast-list li {
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	height: fit-content;
	margin: 70px 0 0;
	padding: 50px 20px 10px;
	position: relative;
	text-align: center;
}

.podcast-list h2 {
	text-transform: uppercase;
}

.podcast-list img {
	border-radius: 50%;
	height: 100px;
	left: 50%;
	margin: 0;
	object-fit: cover;
	position: absolute;
	top: 0;
	transform: translate(-50%, -50%);
	width: 100px;
}

.podcast-list p {
	color: var(--faded-text-color);
	font-size: var(--normal-font-size);
	margin: 0 0 4px;
	padding: 0;
}

/* Podcast details */

#podcast.visible {
	display: grid;
	grid-column-gap: 70px;
	grid-row-gap: 15px;
	grid-template-columns: 250px auto;
}

#podcast > div {
	display: none;
}

#podcast > div.visible {
	display: block;
}

#podcast header {
	box-shadow: var(--shadow);
	padding: 5px 15px;
	margin-bottom: 20px;
}

#podcast header h3 {
	margin: 0;
}

/* Aside for podcast */

aside {
	box-shadow: var(--shadow);
	height: fit-content;
	margin-bottom: 20px;
}

aside img {
	height: auto;
	padding: 20px;
	width: 100%;
}

aside .podcast-name {
	border-bottom: var(--thin-border);
	border-top: var(--thin-border);
	margin: 0 8px;
	padding: 0 8px;
}

aside .podcast-name h2 {
	margin-bottom: 0;
}

aside .podcast-name p {
	color:  var(--faded-text-color);
	font-size: var(--small-font-size);
	padding: 4px 0 10px;
	margin: 0;
}


aside .summary {
	padding: 10px 10px;
	font-size: var(--normal-font-size);
	word-break: break-word;
}

aside .summary h3 {
	font-size: var(--small-font-size);
	margin-bottom: 0;
}

aside .summary p {
	color: var(--faded-text-color);
	font-size: var(--small-font-size);
	font-style: italic;
	margin: 8px 0 4px;
}

/* Table with the episode list */

.table-wrapper {
	box-shadow: var(--shadow);
	padding: 20px;
	margin-bottom: 20px;
}


table {
	border-collapse: collapse;
	table-layout: fixed;
	width: 100%;
	font-size: var(--normal-font-size);
}

td,
th {
	padding: 10px;
}

table tbody tr:nth-child(odd) {
	background: #efefef;
}

table th {
	border-bottom: var(--thin-border);
	text-align: left;
	font-size: var(--normal-font-size);
}

table th:nth-child(2) {
	width: 120px;
}

table th:nth-child(3) {
	width: 80px;
}

table td:nth-child(3) {
	text-align: left;
}

/* Episode details */

#episode-details {
	box-shadow: var(--shadow);
	height: fit-content;
	padding: 20px;
	margin-bottom: 20px;
}

#episode-details h3 {
	margin: 0 0 10px;
	font-size: 1.3rem;
}

#episode-summary {
	font-size: var(--normal-font-size);
	font-style: italic;
	border-bottom: var(--thin-border);
	margin-bottom: 20px;
	padding-bottom: 20px;
}

#episode-details audio {
	width: 100%;
}

/* Error styles */

#error.visible {
	align-items: center;
	display: flex;
	flex-direction: column;
	height: 100%;
	justify-content: center;
}

#error h2 {
	color: #333;
	font-size: 1.5rem;
	text-transform: none;
}

#error small {
	color: var(--faded-text-color);
}

/* Loading styles */

.loading h1:after {
	animation: loading 1.0s infinite ease-in-out;
	background: var(--main-color);
	border-radius: 50%;
	content: ' ';
	display: inline-block;
	height: 20px;
	margin-top: -10px;
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
}

.loading section {
	opacity: 0.5;
	filter: grayscale(100);
	pointer-events: none;
}


/* Smallish screens */
@media (max-width: 1024px) {

	#podcast.visible {
		grid-column-gap: 0;
		grid-row-gap: 15px;
		grid-template-columns: auto;
		width: 100%;
	}

	aside {
		display: grid;
		grid-template-columns: 200px 200px auto;
		width: 100%;
		padding: 20px;
		align-items: center;
		height: fit-content;
	}

	aside img {
		width: 200px;
		padding: 0 20px 0 0;
		height: auto;
	}

	aside .podcast-name {
		border-bottom: 0;
		border-left: var(--thin-border);
		border-right: var(--thin-border);
		border-top: 0;
		text-align: center;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 100%;
	}

	aside .summary {
		padding: 0 0 0 20px;
	}

	aside #podcast-summary {
		max-height: 150px;
		overflow-y: scroll;
		overflow-x: hidden;
	}

}


/* Phones basically */
@media (max-width: 768px) {
	main {
		padding: 0;
	}

	main > header {
		border-bottom: var(--thin-border);
	}

	h1 {
		border-bottom: 0;
	}

	#home {
		padding: 0 20px;
		margin-top: 60px;
	}

	aside {
		display: flex;
		margin-top: 60px;
		flex-direction: column;
	}

	aside h2 {
		border-top: var(--thin-border);
		width: 100%;
		padding-top: 10px;
	}

	aside h2 + p {
		border-bottom: var(--thin-border);
		width: 100%;
	}

	aside .podcast-name {
		border-left: 0;
		border-right: 0;
		width: 100%;
	}

	aside img {
		text-align: center;
	}

	th {
		display: none;
	}

	tr {
		display: block
	}

	td {
		display: block;
	}

	td:nth-child(2),
	td:nth-child(3) {
		font-size: var(--small-font-size);
		padding: 2px 10px;
	}

	td:nth-child(3) {
		padding-bottom: 8px;
	}

	td:before {
		content: attr(data-title);
	}

	td:nth-child(1):before {
		display: none;
	}
}
