:root {
  --sad-primary: #48d6af;
  --sad-secondary: #d0024d;
}

body {
  font-family: "Avenir Next", "sans-serif";
  line-height: 1.5;
  color: #666;
}

p a {
  color: var(--sad-primary);
  text-decoration-style: dotted;
}

header {
  position: relative;
}

.masthead {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-size: cover;
  background-position: center center;
  justify-content: flex-end;
  margin-bottom: 4em;
}

.masthead-colored .masthead-content::before {
  content: " ";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1c7d63;
  mix-blend-mode: color;
}

.masthead-content {
  margin-top: 320px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.95);
}

.main-content,
.gallery,
.user-details,
.top-nav-content,
.content-container {
  margin: 1em auto;
  padding: 0 4em;
  max-width: 1000px;
}

.normal-article {
  margin-bottom: 4em;
}

.top-nav-content {
  margin: 0.5em auto;
}

.top-nav-spacer {
  height: 4em;
}

.lead-content {
  max-width: 500px;
}

.user-details {
  display: flex;
  position: relative;
  flex: 1;
  align-items: center;
}

.avatar-container {
  flex-shrink: 0;
  flex-grow: 0;
  flex-basis: 140px;
  width: 140px;
  height: 140px;
  overflow: hidden;
  border-radius: 100px;
  background-color: #fafafa;
  border: 4px solid white;
  box-shadow: 0px 3px 8px rgba(128, 128, 128, 0.25);
  position: relative;
  margin-top: -70px;
  margin-bottom: -70px;
}

.avatar {
  width: 100%;
  height: 100%;
}

.user-metrics {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  flex: 1;
  align-items: flex-start;
  justify-content: space-around;
  max-width: 400px;
  margin: 0.25em 0 0;
}

.user-metric {
  margin-right: 16px;
  line-height: 2;
  color: var(--sad-primary);
  font-weight: 500;
  font-size: 18px;
}

.user-metric:last-child {
  margin-right: 0;
}

.user-metric__likes {
  color: var(--sad-secondary);
}

h1 {
  font-weight: 100;
  color: #666;
  font-size: 60px;
}

h2 {
  font-weight: 400;
}

h1 .username {
  color: var(--sad-primary);
  font-weight: 700;
}

.entry-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

@media only screen and (max-width: 720px) {
  .main-content,
  .gallery,
  .user-details,
  .top-nav-content,
  .content-container {
    padding: 0 1em;
  }

  .entry-group:nth-child(2n - 1) {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .entry-group:nth-child(2n - 1) {
    grid-auto-flow: column;
  }

  .entry-group:nth-child(2n - 1) .entry:first-child {
    grid-column: span 2;
    grid-row: span 2;
  }

  .image-caption {
    display: none;
  }

  .entry-group:nth-child(2n - 1) .entry:first-child .image-caption {
    display: block;
  }

  .entry-group:nth-child(4n - 1) .entry:first-child .image-caption {
    display: none;
  }

  .entry-group:nth-child(4n - 1) .entry:last-child .image-caption {
    display: block;
  }

  .entry-group:nth-child(4n - 1) .entry:first-child {
    grid-column: span 1;
    grid-row: span 1;
  }

  .entry-group:nth-child(4n - 1) .entry:last-child {
    grid-column: span 2;
    grid-row: span 2;
  }
}

.entry {
  outline: 1px solid white;
  width: 100%;
  margin: 0;
  position: relative;
}

.entry img {
  width: 100%;
  height: 100%;
  margin: 0;
  display: block;
}

.entry figcaption {
  color: #333;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  text-align: center;
  opacity: 0;
  transition: 300ms opacity linear;
}

.entry figcaption:hover {
  opacity: 1;
}

.image-title {
  display: block;
  margin-top: 25%;
  font-size: 24px;
  font-weight: 600;
}

.image-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 5%;
  text-align: left;
  font-size: 12px;
}

@media only screen and (max-width: 600px) {
  .masthead {
    margin-bottom: 2em;
  }
  .masthead-content {
    margin-top: 170px;
  }

  .lead-content {
    max-width: none;
  }

  .user-details {
    flex-direction: column;
    align-items: center;
    padding-top: 1.5em;
  }

  h1 {
    margin-top: 0;
    font-size: 2.4em;
  }

  h1,
  h2 {
    text-align: center;
  }

  .normal-article h2,
  .normal-article h1 {
    text-align: left;
  }

  .lead-content,
  .gallery-intro {
    text-align: center;
  }

  .store-badges {
    justify-content: center;
    flex-wrap: wrap;
  }

  .avatar-container {
    width: 100px;
    height: 100px;
    flex-basis: 100px;
    position: absolute;
    bottom: 100%;
    margin: 0;
    margin-bottom: -1.4em;
  }

  .user-metric {
    font-size: 16px;
  }

  .gallery {
    margin: 0;
    padding: 0;
  }
}

.store-badge {
  height: 75px;
  display: inline-block;
}

.store-badge--apple {
  height: 50px;
}

.store-badges {
  display: flex;
  align-items: center;
}

.store-badges a {
  display: flex;
}

.follow-me p {
  font-size: 120%;
}

.follow-me {
  padding-bottom: 0.5em;
  border-top: 1px dotted var(--sad-primary);
  margin: 4em 0;
  border-bottom: 1px dotted var(--sad-primary);
}

.follow-me-username {
  color: var(--sad-primary);
  font-weight: bold;
}

.top-nav-bar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1;
  background-color: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #eee;
}

.top-nav-content {
  display: flex;
  align-items: center;
}

.top-nav-link {
  flex: 1;
  font-size: 1.5em;
  text-decoration: none;
  font-weight: 600;
  color: var(--sad-primary);
}

@media only screen and (max-width: 380px) {
  .top-nav-link {
    display: none;
  }

  .top-nav-content {
    justify-content: center;
  }
}

.top-nav-bar .store-badges {
  flex-shrink: 0;
}

.top-nav-bar .store-badge {
  height: 40px;
}

.top-nav-bar .store-badge--apple {
  height: 28px;
}

/* Leaderboard */

.leaderboard {
  display: grid;
  column-gap: 1em;
  row-gap: 2em;
  margin: 4em 0;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.leaderboard-user {
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  padding: 1em;
  text-decoration: none;
  position: relative;
  text-align: center;
  margin-top: 3em;
  display: flex;
  flex-direction: column;
  transition: all 300ms ease-in-out;
}

.leaderboard-user__avatar {
  width: 100px;
  height: 100px;
  border-radius: 100px;
  border: 4px solid white;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
  margin-top: -4em;
  align-self: center;
  background-color: #eee;
  transition: all 200ms ease-in-out;
}

.leaderboard-user--GOLD_MEMBERSHIP .leaderboard-user__avatar {
  border-color: #eaca2d;
  box-shadow: 0 2px 4px #cab659;
}

.leaderboard-user--SUPPORTER_MEMBERSHIP .leaderboard-user__avatar {
  border-color: var(--sad-secondary);
}

.leaderboard-user:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-0.15em);
}

.leaderboard-user:hover .leaderboard-user__avatar {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-0.1em) scale(1.03);
}

.leaderboard-user__username {
  display: block;
  color: var(--sad-primary);
  font-size: 1.4em;
  font-weight: 500;
  margin: 0.5em 0;
}

.leaderboard-user__count {
  font-weight: 500;
  color: var(--sad-secondary);
}
