@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;800&display=swap");

@font-face {
  font-family: "charming_smile";
  src: url("../fonts/charming-smile-demo.regular-webfont.woff2") format("woff2"),
    url("../fonts/charming-smile-demo.regular-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  padding: 0;
  margin: 0;
}
.logo {
  position: fixed;
  display: flex;
  width: 100vw;
  justify-content: center;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  transition: background-color cubic-bezier(0.4, 0, 0.2, 1) 0.6s;
  z-index: 1000;
  pointer-events: none;
}
.logo svg {
  height: 100%;
  transition: opacity cubic-bezier(0.4, 0, 0.2, 1) 0.6s;
}
.hide {
  background-color: rgba(0, 0, 0, 0);
}
.hide svg {
  opacity: 0;
}
.hidden {
  display: none;
}
.shown {
  display: block;
}
.id {
  position: absolute;
  z-index: 10;
}
nav {
  text-align: center;
  display: none;
}
nav a {
  padding: 0 1em;
}
nav .info {
  display: block;
}
a {
  text-decoration: none;
  cursor: pointer;
}
p a {
  border-bottom: 1px dashed #696b66;
}
body {
  background: #0c0d10;
  font-family: "Open Sans", sans-serif;
  font-weight: 400;
}
body,
a {
  color: #f5f5f5;
}
h1,
h2,
h3 {
  font-weight: 300;
}
h1,
h2,
h3,
h4,
.id {
  font-family: charming_smile, sans-serif;
  color: #ffffff;
}
.id {
  opacity: 0;
  font-size: 2rem;
  text-shadow: 1px 1px 30px #00000059;
  letter-spacing: 0.08em;
  transition: opacity ease-in-out 0.25s;
}
.episode-player-image:hover .id,
.episode-player-image:focus .id {
  opacity: 1;
}
h4 {
  font-weight: 800;
}
main.home {
  width: 100vw;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  grid-gap: 0;
  grid-auto-rows: 1fr;
}

/* Responsive grid breakpoints */
@media (min-width: 480px) {
  main.home {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 800px) {
  main.home {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1200px) {
  main.home {
    grid-template-columns: repeat(8, 1fr);
  }
}
audio {
  width: 100%;
}
article {
  display: flex;
  flex-wrap: wrap;
}
article .episode-player-image {
  width: 150px;
  height: 150px;
  flex: 0 0 auto;
  padding: 1rem 1rem 1rem 0;
}
.episode-player-image {
  aspect-ratio: 1;
  position: relative;
  width: 100%;
  height: 100%;
}
.episode-player-image a {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}
.episode-player-image picture {
  width: 100%;
  height: 100%;
}
.episode-player-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1b1f;
  transition: opacity 0.3s ease-in-out;
}
.episode-player-image img.placeholder {
  filter: blur(5px);
  transform: scale(1.1);
}
.episode-player-image img.loaded {
  filter: none;
  transform: scale(1);
}
article .info {
  flex-direction: column;
  flex: 1 0 40%;
}
.info > p {
  margin-top: 0;
}
.episode-player-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#episode-player {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.player-info-container {
  display: flex;
  justify-content: center;
  max-width: 80%;
}
.episode-text {
  display: block;
  white-space: pre-wrap;
  padding: 0 2rem 2rem;
  max-width: 700px;
  margin: 0 auto;
}

/* Random episode button */
.random-button {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #f5f5f5;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
  text-decoration: none;
}

.random-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  color: #f5f5f5;
}

.random-button:active {
  transform: translateY(0);
}

.random-button svg {
  width: 24px;
  height: 24px;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #f5f5f5;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  font-family: "Open Sans", sans-serif;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
}

.intro {
  display: none;
  width: 100%;
  padding: 2rem;
  text-align: center;
}

@media screen and (max-width: 619px) {
  .player-info-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
  }
  #player-info {
    padding: 2rem;
  }
  
  /* Adjust random button for mobile */
  .random-button {
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }

  .random-button svg {
    width: 20px;
    height: 20px;
  }

  /* Adjust back to top button for mobile */
  .back-to-top {
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
}

@media screen and (min-width: 620px) {
  #episode-player {
    width: 87%;
    height: 87%;
    background-size: contain;
  }

  #episode-player #player-info {
    max-width: 480px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    outline: 30px solid rgba(0, 0, 0, 0.3);
  }
}
