main {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  max-width: 60rem;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

article {
  flex: 1;
}

h1 {
  margin-top: 0;
}

aside {
  width: 16rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#skin-canvas {
  display: block;
}

/* Spotify and the Limerick clock share a row on larger screens. */
.activity-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  max-width: 52rem;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}

.spotify-section {
  display: flex;
  justify-content: center;
  flex: 0 1 24rem;
  min-width: 0;
}

#spotify {
  width: min(100%, 24rem);
  box-sizing: border-box;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 2px solid currentColor;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-decoration: none;
  color: inherit;
}

#spotify img {
  width: 3.5rem;
  height: 3.5rem;
  image-rendering: auto;
  background: rgba(0, 0, 0, 0.1);
}

#spotify .info {
  min-width: 0;
  flex: 1;
}

#spotify .title,
#spotify .artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#spotify .title {
  font-weight: 700;
}

#spotify .label {
  opacity: 0.6;
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}

#spotify .bar {
  height: 4px;
  margin-top: 0.4rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

#spotify .bar > div {
  height: 100%;
  width: 0;
  background: currentColor;
}

#spotify .times {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  opacity: 0.7;
}

.contributions {
  max-width: 60rem;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  text-align: center;
}

.contributions h2 {
  margin-bottom: 0.4rem;
}

.contribution-summary {
  margin: 0 0 1rem;
}

.contribution-scroll {
  overflow-x: hidden;
  padding-bottom: 0.5rem;
}

.contribution-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 0.75rem);
  grid-auto-columns: 0.75rem;
  gap: 0.2rem;
  width: max-content;
  margin: 0 auto;
}

.contribution-day {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.contribution-day[data-level="0"] {
  background: #d1d5d2;
}

.contribution-day[data-level="1"] {
  background: #9be9a8;
}

.contribution-day[data-level="2"] {
  background: #40c463;
}

.contribution-day[data-level="3"] {
  background: #30a14e;
}

.contribution-day[data-level="4"] {
  background: #216e39;
}

.contribution-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.contribution-legend .contribution-day {
  display: inline-block;
}

/* The cookie count starts over whenever the page reloads. */
.cookie-clicker {
  text-align: center;
}

.cookie-clicker h2 {
  margin-bottom: 0.4rem;
}

#cookie-count {
  margin: 0 0 0.75rem;
}

#cookie-message {
  min-height: 1.5em;
  margin: 0 0 0.5rem;
}

#cookie-button {
  border: 2px solid currentColor;
  border-radius: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--header-background);
  color: inherit;
  font: inherit;
  font-size: 2rem;
  cursor: pointer;
  transition: transform 100ms ease;
}

#cookie-button:hover {
  transform: scale(1.08);
}

#cookie-button:active {
  transform: scale(0.96);
}

@media (max-width: 600px) {
  main {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
  }

  aside {
    width: 100%;
    max-width: 20rem;
  }

  .contribution-grid {
    grid-template-columns: repeat(53, minmax(0, 1fr));
    grid-template-rows: repeat(7, clamp(0.3rem, 1.5vw, 0.75rem));
    grid-auto-columns: auto;
    gap: clamp(0.5px, 0.2vw, 1.5px);
    width: 100%;
  }

  .contribution-grid .contribution-day {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
  }

  .activity-row {
    flex-direction: column;
  }

  .spotify-section {
    flex: none;
    width: 100%;
  }

  #spotify {
    width: 100%;
  }

  .cookie-clicker {
    width: 100%;
  }
}
