:root {
  --external-icon-size: 16px;
  --expand-icon-size: 30px;
  --color-link: #5c8df5;
  --width-tablet: 768px;
  --color-blockquote-text-highlight: #a1d7e6;
}

figure {
  --color-link-shadow: #0f1015;
  --color-white: #fff;
  --color-background: #3c4252;
  --color-shadow-rest: #0f1015;
  --color-shadow-highlight: #2c1b2a;
  --color-blockquote-bg: #2e3441;
  --color-blockquote-text: #88c0d0;
  --height-header: 70px;
  --syntax-icon-size: 24px;
  --border-radius: 40px;
}

.poetry-item {
  margin: 0 0 50px 0;
  position: relative;
  transition: opacity 600ms ease;
  opacity: 0;
}

@media (min-width: 768px) {
  .poetry-item {
    margin: 0;
  }
}

figure {
  border-top-right-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
  background-color: var(--color-background);
  box-shadow: var(--color-shadow-rest) 0px 0px 60px -20px;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 3px;
  transition: opacity 600ms ease, box-shadow 600ms ease;
  pointer-events: none;
  position: relative;
  z-index: 5;
}

@media (pointer: fine) {
  figure:active,
  figure:hover,
  figure:focus {
    box-shadow: var(--color-shadow-highlight) 0px 0px 60px -20px;
  }
}

.external-link svg {
  fill: var(--color-text);
  width: var(--external-icon-size);
  height: var(--external-icon-size);
  margin: 0 0 0 5px;
  stroke: none;
}

.external-link {
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 14px 0 0 0;
  transition: opacity 300ms ease;
  opacity: 0.5;
}

.external-link:hover,
.external-link:active,
.external-link:focus {
  opacity: 1;
}

.bg {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 600ms ease;
  background: linear-gradient(45deg, #4b2e46, #b48ead, #4b2e46);
  border-top-right-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
}

@media (pointer: fine) {
  .poetry-item:active .bg,
  .poetry-item:hover .bg,
  .poetry-item:focus .bg {
    opacity: 1;
  }
}

.active {
  opacity: 1;
  pointer-events: all;
}

.faded {
  opacity: 0.3;
}

figure:active,
figure:focus,
figure:hover {
  opacity: 1;
}

blockquote {
  position: relative;
  z-index: 10;
  margin: 0;
  padding: 20px 16px 100px 16px;
  max-height: 280px;
  height: 280px;
  flex: 1 0 auto;
  justify-self: flex-start;
  display: block;
  background-color: var(--color-blockquote-bg);
  color: var(--color-blockquote-text);
  overflow: hidden;
  font-weight: 400;
  transition: color 600ms ease, background-color 600ms ease;
}

@media (min-width: 480px) {
  blockquote {
    padding: 40px 25px 100px 25px;
  }
}

@media (pointer: fine) {
  figure:active blockquote,
  figure:hover blockquote,
  figure:focus blockquote {
    color: var(--color-blockquote-text-highlight);
  }
}

figcaption,
.source {
  position: relative;
  z-index: 10;
  padding: 0 16px;
  flex: 0 0 var(--height-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-blockquote-bg);
  color: var(--color-text);
}

@media (min-width: 480px) {
  figcaption,
  .source {
    padding: 0 25px;
  }
}

figcaption {
  margin: 0 0 2px 0;
  border-top-right-radius: var(--border-radius);
}

figcaption span {
  font-weight: 300;
  font-size: 2rem;
}

.source {
  margin: 2px 0 0 0;
  border-bottom-left-radius: var(--border-radius);
}

.action {
  border-radius: 50%;
  padding: 5px;
  display: block;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--color-link);
  margin: 0 -8px 0 0;
  box-shadow: 0 4px 24px -5px var(--color-link-shadow);
  transition: box-shadow 300ms ease, background-color 300ms ease;
}

@media (pointer: fine) {
  .action:hover,
  .action:active,
  .action:focus,
  .poetry-item:hover .action,
  .poetry-item:active .action,
  .poetry-item:focus .action {
    box-shadow: 0 4px 16px -7px transparent;
    background-color: var(--color-link-hovered);
  }
}

.source img {
  width: var(--external-icon-size);
  height: var(--external-icon-size);
}

.source > div {
  display: flex;
  align-items: center;
}

.source > i {
  font-size: 0.8em;
}

.overflow {
  position: absolute;
  z-index: 2;
  background: linear-gradient(
    rgba(255, 255, 255, 0) 5%,
    rgba(46, 52, 65, 0.9) 95%
  );
  display: block;
  height: 180px;
  width: 100%;
  top: -182px;
  left: 0;
  padding: 0 0 16px 0;
}

.source > .overflow {
  align-items: flex-end;
  justify-content: center;
  display: none;
  fill: var(--color-text);
}

.has-overflow .source > .overflow {
  display: flex;
}

.overflow svg {
  width: var(--expand-icon-size);
  height: var(--expand-icon-size);
}

.syntax {
  display: flex;
  /* width: var(--syntax-icon-size);
  height: var(--syntax-icon-size); */
  margin: 0 5px 0 0;
  align-items: center;

  filter: grayscale(70%);
  transition: filter 600ms ease;
}

.syntax img {
  margin: 0 4px;
}

#dialog .syntax {
  filter: grayscale(20%);
}

@media (pointer: fine) {
  .poetry-item:active .syntax,
  .poetry-item:hover .syntax,
  .poetry-item:focus .syntax {
    filter: grayscale(20%);
  }
}

.no-overflow {
  overflow: hidden;
}

.share-buttons {
  position: absolute;
  top: 12px;
  right: 20px;
  display: none;
}

dialog .share-buttons {
  display: block;
}

@media (min-width: 480px) {
  .share-buttons {
    right: 25px;
  }
}
