#comments {
	#qrcode {
		float: inline-end;
		transform-origin: right;
		box-sizing: content-box;
		margin-inline-start: 1rem;
		margin-block-start: 3rem;
		margin-block-end: 0;
		background-color: white;
		padding: 0.75rem;
		width: 7.8125rem; // 125px
		height: 7.8125rem; // 125px

		:root[dir*="rtl"] & {
			transform-origin: left;
		}

		@media only screen and (max-width: 720px) {
			display: none;
		}
	}

	.buttons {
		justify-content: start;
		gap: 0.25rem;
		margin-block-start: 2rem;

		#load-comments:disabled {
			--shimmer: rgb(
				from var(--accent-color) r g b / calc(var(--color-opacity) * 2)
			);
			animation: loading-shimmer var(--transition-long) ease-in-out
				alternate infinite;
			transition: none;
			background-image: linear-gradient(
				to right,
				var(--fg-muted-1) 50%,
				var(--shimmer) 75%,
				var(--fg-muted-1) 100%
			);
			background-size: 200%;
			background-color: transparent;

			&:hover {
				background-color: transparent;
			}

			@keyframes loading-shimmer {
				to {
					background-position-x: -200%;
				}
			}
		}
	}

	#comments-wrapper {
		display: flex;
		flex-direction: column;
		gap: 2rem;
		margin-block-start: 2rem;

		#comments-status {
			color: var(--fg-muted-4);
			font-weight: bold;
			font-size: var(--font-size-x-large);
			text-align: center;
		}

		.comment {
			display: grid;
			grid-template-columns: min-content;
			grid-template-areas:
				"avatar name        "
				"avatar time        "
				"avatar post        "
				"...... media       "
				"...... card         "
				"...... interactions";
			column-gap: 1rem;
			justify-items: start;

			&.comment-reply {
				position: relative;
				border-radius: 0.25rem;
				border-inline-start: 0.25rem solid var(--fg-muted-2);
				padding-inline-start: 1rem;

				&:has(+ .comment-reply) {
					border-end-start-radius: 0;
				}

				& + .comment-reply {
					margin-block-start: -2rem;
					border-start-start-radius: 0;
					padding-block-start: 2rem;
				}
			}

			.avatar-link {
				position: relative;
				grid-area: avatar;
				width: 4rem;
				height: 4rem;

				.avatar {
					transition: var(--transition);
					margin: 0;
					background-size: cover;
					width: 100%;
					height: 100%;

					&:hover {
						transform: rotate(10deg) var(--hover);
						border-radius: var(--rounded-corner);
					}

					&:active {
						transform: var(--active);
					}
				}
			}

			.author {
				display: flex;
				grid-area: name;
				align-items: center;
				gap: 0.25rem;
				font-weight: bold;

				.instance {
					transition: var(--transition);
					box-shadow: var(--edge-highlight);
					border-radius: 999px;
					background-color: var(--fg-muted-1);
					padding: 0.375rem 0.75rem;
					color: var(--fg-muted-5);
					font-size: var(--font-size-small);
					line-height: 1;
					text-decoration: none;

					&:hover {
						background-color: var(--fg-muted-5);
						color: var(--fg-contrast);
						text-decoration: none;
					}

					&:active {
						transform: var(--active);
					}

					&.op {
						background-color: var(--accent-color-alpha);
						padding-inline-start: 0.4375rem;
						color: var(--accent-color);

						&:hover {
							background-color: var(--accent-color);
							color: var(--contrast-color);

							&::before {
								background-color: var(--contrast-color);
							}
						}

						&::before {
							-webkit-mask-image: var(--icon-verified);
							display: inline-block;
							vertical-align: -0.1875rem;
							mask-image: var(--icon-verified);
							mask-size: cover;
							transition: var(--transition);
							margin-inline-end: 0.25rem;
							background-color: var(--accent-color);
							width: 1rem;
							height: 1rem;
							content: "";
						}

						:root[dir*="rtl"] & {
							padding: 0.375rem 0.5rem 0.375rem 0.75rem;
						}
					}
				}
			}

			.mention {
				display: inline-block;
				transition: var(--transition);
				box-shadow: var(--edge-highlight);
				border-radius: var(--rounded-corner-small);
				background-color: var(--accent-color-alpha);
				padding: 0.25rem 0.375rem;
				line-height: 1;
				text-decoration: none;

				&:hover {
					background-color: var(--accent-color);
					color: var(--contrast-color);
				}

				&:active {
					transform: var(--active);
				}

				&.hashtag {
					background-color: var(--fg-muted-1);
					color: var(--fg-muted-5);

					&:hover {
						background-color: var(--fg-muted-5);
						color: var(--fg-contrast);
					}
				}
			}

			time {
				grid-area: time;
				margin-block-start: 0.5rem;
				font-size: var(--font-size-small);

				a {
					color: var(--fg-muted-5);

					&:after {
						background-color: var(--fg-muted-5);
					}
				}
			}

			details {
				&[open] {
					border-radius: var(--rounded-corner-small);
					background-image: linear-gradient(
							to right,
							transparent,
							transparent 0.5rem,
							var(--fg-muted-1) 0.5rem,
							var(--fg-muted-1) calc(100% - 0.5rem),
							transparent calc(100% - 0.5rem),
							transparent
						),
						linear-gradient(
							to right,
							transparent,
							transparent 0.5rem,
							var(--bg-color) 0.5rem,
							var(--bg-color) calc(100% - 0.5rem),
							transparent calc(100% - 0.5rem),
							transparent
						),
						repeating-linear-gradient(
							45deg,
							var(--contrast-color),
							var(--contrast-color) 0.25rem,
							var(--accent-color) 0.25rem,
							var(--accent-color) 0.5rem
						);

					summary {
						border-radius: 0;
						background-image: none;
					}
				}

				summary {
					border-radius: var(--rounded-corner-small);
					background-image: linear-gradient(
							to right,
							transparent,
							transparent 0.5rem,
							var(--fg-muted-1) 0.5rem,
							var(--fg-muted-1) calc(100% - 0.5rem),
							transparent calc(100% - 0.5rem),
							transparent
						),
						linear-gradient(
							to right,
							transparent,
							transparent 0.5rem,
							var(--bg-color) 0.5rem,
							var(--bg-color) calc(100% - 0.5rem),
							transparent calc(100% - 0.5rem),
							transparent
						),
						repeating-linear-gradient(
							45deg,
							var(--contrast-color),
							var(--contrast-color) 0.25rem,
							var(--accent-color) 0.25rem,
							var(--accent-color) 0.5rem
						);
				}
			}

			main {
				grid-area: post;
				margin: 1rem 0 0;
				width: 100%;

				:first-child {
					margin-block-start: 0;
				}

				:last-child {
					margin-block-end: 0;
				}
			}

			.attachments {
				display: grid;
				grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
				grid-area: media;
				gap: 0.5rem;
				margin-block-start: 1rem;

				img,
				video {
					margin: 0;
				}
			}

			.card {
				grid-area: card;
				transition: var(--transition);
				margin-block-start: 1rem;
				width: min(calc(var(--container-width) / 2), 100%);
				font-weight: normal;
				text-decoration: none;

				&:hover:not(:active) {
					img {
						transform: var(--hover);
						box-shadow: var(--edge-highlight), var(--shadow-raised);
						border-radius: var(--rounded-corner-small);
					}

					figcaption {
						border-radius: var(--rounded-corner);
						background-color: var(--fg-muted-2);
					}
				}

				&:active {
					transform: var(--active);
				}

				figure {
					display: flex;
					flex-direction: column;
					gap: 0.25rem;
					margin: 0;

					img {
						margin: 0;
						border-radius: var(--rounded-corner)
							var(--rounded-corner) var(--rounded-corner-small)
							var(--rounded-corner-small);
						aspect-ratio: 16 / 9;
						object-fit: cover;

						& + figcaption {
							border-radius: var(--rounded-corner-small)
								var(--rounded-corner-small)
								var(--rounded-corner) var(--rounded-corner);
						}
					}

					figcaption {
						display: flex;
						flex-direction: column;
						gap: 0.25rem;
						transition: var(--transition);
						box-shadow: var(--edge-highlight);
						border-radius: var(--rounded-corner);
						background-color: var(--fg-muted-1);
						padding: 1rem;
						color: var(--fg-color);
						font-size: var(--font-size-medium);
						text-align: start;

						p {
							margin: 0;
							color: var(--fg-muted-5);
							font-size: var(--font-size-small);
						}
					}
				}
			}

			footer {
				display: flex;
				grid-area: interactions;
				gap: 0.25rem;
				margin-block-start: 1rem;

				.boosts,
				.faves {
					transition: var(--transition);
					border-radius: 999px;
					background-color: transparent;
					padding: 0.5rem 0.75rem;
					padding-inline-start: 0.625rem;
					line-height: 1;
					font-variant-numeric: tabular-nums;
					text-decoration: none;

					.icon {
						vertical-align: -0.125em;
						transition: var(--transition-longer);
						margin-inline-end: 0.25rem;
					}

					&:hover {
						box-shadow: var(--edge-highlight);
						text-decoration: none;
					}

					&:active {
						transform: var(--active);
					}
				}

				.boosts {
					color: var(--purple-fg);

					&:hover {
						background-color: var(--purple-bg);

						.icon {
							transform: rotate(180deg);

							:root[dir*="rtl"] & {
								transform: scaleX(-1) rotate(180deg);
							}
						}
					}

					.icon {
						-webkit-mask-image: var(--icon-boosts);
						mask-image: var(--icon-boosts);

						:root[dir*="rtl"] & {
							transform: scaleX(-1);
						}
					}
				}

				.faves {
					color: var(--yellow-fg);

					&:hover {
						background-color: var(--yellow-bg);

						.icon {
							transform: rotate(72deg);

							:root[dir*="rtl"] & {
								transform: rotate(-72deg);
							}
						}
					}

					.icon {
						-webkit-mask-image: var(--icon-star);
						mask-image: var(--icon-star);
					}
				}
			}
		}
	}
}
