@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.f6934ee52f3a.woff2") format("woff2"),
    url("../fonts/charming-smile-demo.regular-webfont.5e5af95f23c6.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;
}

/* Site menu */
.site-menu-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.menu-button {
  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);
  text-decoration: none;
}

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

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

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

.site-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: rgba(12, 13, 16, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.5rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.site-menu[hidden] {
  display: none;
}

.site-menu-section {
  padding: 0.5rem 0;
}

.site-menu-section + .site-menu-section {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.site-menu-heading {
  margin: 0;
  padding: 0 1.2rem 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(245, 245, 245, 0.5);
}

.site-menu a {
  display: block;
  padding: 0.5rem 1.2rem;
  color: #f5f5f5;
  text-decoration: none;
  font-size: 0.95rem;
}

.site-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Radio: the one menu item that gets an icon, so it reads as the way in */
.site-menu a.site-menu-radio {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.2rem;
  color: #d8e8cf;
}

.site-menu a.site-menu-radio:hover {
  background: rgba(160, 200, 140, 0.14);
  color: #eaf5e3;
}

.site-menu-radio-icon {
  flex: none;
}

.site-menu-radio-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.site-menu-radio-text small {
  font-size: 0.72rem;
  color: rgba(216, 232, 207, 0.6);
}

.site-menu-radio-live {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8fd07a;
  box-shadow: 0 0 0 0 rgba(143, 208, 122, 0.7);
  animation: radio-pulse 2s ease-out infinite;
}

@keyframes radio-pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(143, 208, 122, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(143, 208, 122, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-menu-radio-live {
    animation: none;
  }
}

.site-menu button.copy-feed-link {
  display: block;
  width: 100%;
  padding: 0.5rem 1.2rem;
  background: none;
  border: none;
  color: #f5f5f5;
  text-decoration: none;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.site-menu button.copy-feed-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.copy-toast {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: rgba(12, 13, 16, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  color: #f5f5f5;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.copy-toast[hidden] {
  display: none;
}

/* Random episode button (episode pages) */
.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 all episodes button (episode pages) */
.back-button {
  position: fixed;
  top: 20px;
  left: 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;
}

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

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

.back-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 menu button for mobile */
  .site-menu-wrapper {
    top: 15px;
    right: 15px;
  }

  .menu-button {
    width: 45px;
    height: 45px;
  }

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

  /* Adjust random button for mobile */
  .random-button {
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }

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

  /* Adjust back button for mobile */
  .back-button {
    top: 15px;
    left: 15px;
    width: 45px;
    height: 45px;
  }

  .back-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);
  }
}

/* Radio player page */
main.radio {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  box-sizing: border-box;
  /* A low moss-coloured glow behind the stage, so the page has the same
     lit-from-within feel as the episode covers on the index. */
  background:
    radial-gradient(
      ellipse 60% 45% at 50% 45%,
      rgba(96, 140, 80, 0.18),
      rgba(12, 13, 16, 0) 70%
    );
}

.radio-stage {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.radio-title {
  margin: 0;
  font-size: 3.4rem;
  letter-spacing: 0.06em;
}

.radio-strap {
  margin: 0.2rem 0 0;
  color: rgba(216, 232, 207, 0.55);
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.radio-wave {
  display: block;
  width: 100%;
  height: 200px;
  margin: 1.2rem 0 0.5rem;
}

.radio-now {
  margin: 0 0 2.2rem;
  min-height: 1.5em;
  font-size: 1.15rem;
  font-weight: 300;
  color: #d8e8cf;
}

.radio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
}

.radio-button {
  background: rgba(0, 0, 0, 0.45);
  color: #d8e8cf;
  border: 2px solid rgba(143, 208, 122, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.4s ease;
}

.radio-button:hover {
  background: rgba(143, 208, 122, 0.16);
  border-color: rgba(143, 208, 122, 0.7);
  transform: translateY(-2px);
}

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

.radio-button:focus-visible {
  outline: 2px solid #8fd07a;
  outline-offset: 4px;
}

.radio-button-main {
  width: 110px;
  height: 110px;
}

/* Nudge the play triangle off centre so it reads as centred in the circle. */
.radio-button-main .icon-play {
  margin-left: 6px;
}

.radio-button-main .icon-pause,
.radio-button-main.is-playing .icon-play {
  display: none;
}

.radio-button-main.is-playing .icon-pause {
  display: block;
}

.radio-button-mute .icon-muted,
.radio-button-mute[aria-pressed="true"] .icon-unmuted {
  display: none;
}

.radio-button-mute[aria-pressed="true"] .icon-muted {
  display: block;
}

.radio-button-main.is-playing {
  border-color: rgba(143, 208, 122, 0.75);
  box-shadow: 0 0 34px rgba(143, 208, 122, 0.22);
}

.radio-button-mute {
  width: 68px;
  height: 68px;
}

.radio-button-mute[aria-pressed="true"] {
  color: rgba(216, 232, 207, 0.45);
  border-color: rgba(255, 255, 255, 0.18);
}

.radio-note {
  margin: 2.6rem 0 0;
  font-size: 0.8rem;
  color: rgba(216, 232, 207, 0.4);
}

.radio-note a {
  color: rgba(216, 232, 207, 0.65);
  border-bottom: 1px dashed rgba(216, 232, 207, 0.3);
}

@media screen and (max-width: 620px) {
  main.radio {
    padding: 3rem 1.2rem;
  }

  .radio-title {
    font-size: 2.6rem;
  }

  .radio-wave {
    height: 140px;
  }

  .radio-button-main {
    width: 92px;
    height: 92px;
  }

  .radio-button-mute {
    width: 60px;
    height: 60px;
  }
}
