:root {
  --color-white: hsl(0, 0%, 98%);
  --color-gray: hsl(240, 5%, 65%);
  --color-dark-gray: hsl(240, 5%, 25%);
  --color-black: hsl(240, 10%, 4%);
}

::selection {
  color: var(--color-white);
  background-color: var(--color-dark-gray);
}

* {
  margin: 0;
}

html {
  scrollbar-width: thin;
  scrollbar-gutter: stable both-edges;
  color-scheme: only dark;
  background-color: var(--color-black);
  font-family: system-ui, sans-serif;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

body {
  padding: 25px;
  min-height: calc(100dvh - 50px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* prettier-ignore */
header, main, footer {
  display: grid;
  place-content: center;
}

main {
  flex-grow: 1;
  padding-block: 60px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-items: center;
  gap: 15px;
  margin-inline: auto;
}

.button {
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  height: 40px;
  border-radius: 5px;
  color: var(--color-white);
  transition-duration: 200ms;
  transition-property: color, background-color, scale, outline-width;

  &:active {
    scale: 0.99;
  }

  &:focus-visible {
    outline-offset: 3px;
    outline: 3px solid var(--color-dark-gray);
  }

  &:disabled {
    opacity: 50%;
    cursor: not-allowed;
  }

  &::selection {
    background-color: var(--color-black);
  }
}

.next-button {
  width: 125px;
  border: none;
  background-color: var(--color-dark-gray);

  @media (hover: hover) {
    &:enabled:hover {
      color: var(--color-black);
      background-color: var(--color-white);
    }
  }
}

.share-button {
  width: 40px;
  display: grid;
  place-content: center;
  border: 3px solid var(--color-dark-gray);
  background-color: transparent;

  &[data-can-share='true'] > .copy-icon {
    display: none;
  }

  &[data-can-share='false'] > .share-icon {
    display: none;
  }

  &.is-copying > .copy-icon {
    display: none;
  }

  &.is-copying > .copy-tick-icon {
    display: inline-block;
  }

  @media (hover: hover) {
    &:enabled:hover {
      background-color: var(--color-dark-gray);
    }
  }
}

.copy-tick-icon {
  display: none;
}

.quote-wrapper {
  max-width: 600px;
  transition-duration: 300ms;
  transition-property: opacity, translate;

  transition-delay: 350ms; /* Will be overridden to 0ms with JavaScript for later transitions. */
  @starting-style {
    opacity: 0;
    translate: 0 10px;
  }

  &.is-changing {
    opacity: 0;
    translate: 0 10px;
  }
}

.quote-text {
  text-wrap: balance;
  text-wrap: pretty;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--color-white);

  &::before {
    content: open-quote;
    color: var(--color-gray);
  }

  &::after {
    content: close-quote;
    color: var(--color-gray);
  }
}

.quote-author {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--color-gray);
}

.copyright {
  color: var(--color-gray);
}

@media (width >= 500px) {
  .quote-text {
    font-size: 1.5rem;
  }

  .quote-author {
    font-size: 1rem;
  }
}

@media (width >= 1000px) {
  .next-quote-button {
    font-size: 1rem;
    width: 140px;
  }

  .quote-text {
    font-size: 1.75rem;
  }

  .quote-author {
    font-size: 1.1rem;
  }

  .copyright {
    font-size: 1rem;
  }
}
