// =============================================================================
// pages/_single.scss
// =============================================================================

// Reading progress bar.
.reading-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 9999;
	background: transparent;
	pointer-events: none;

	&__bar {
		height: 100%;
		width: 0;
		background: var(--color-primary);
		transition: width 0.1s linear;
	}
}

// Hero featured image.
.single-hero {
	position: relative;
	width: 100%;
	max-height: 450px;
	overflow: hidden;
	border-radius: var(--card-radius);
	margin-bottom: var(--space-4);

	&__image {
		width: 100%;
		height: 450px;
		object-fit: cover;
		display: block;
		loading: eager;
	}

	&__overlay {
		position: absolute;
		inset: 0;
		background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 60%);
		display: flex;
		align-items: flex-end;
		padding: var(--space-5);
	}

	&__title {
		color: #fff;
		font-size: clamp(1.5rem, 4vw, 2.5rem);
		text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
		margin: 0;
	}
}

// Single article layout.
.single-layout {
	align-items: flex-start;
}

// Social share.
.social-share {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
	margin: var(--space-4) 0;
	padding: var(--space-3);
	background: var(--color-surface);
	border-radius: var(--card-radius);
	border: 1px solid var(--color-border);

	&__label {
		font-size: 0.875rem;
		color: #6b7280;
	}

	&__btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.25rem;
		height: 2.25rem;
		border-radius: 50%;
		background: var(--color-border);
		color: var(--color-text);
		border: none;
		font-size: 1rem;
		text-decoration: none;
		transition:
			background-color var(--transition-base),
			color var(--transition-base);

		&:hover {
			background-color: var(--color-primary);
			color: #fff;
		}

		&--weibo:hover  { background-color: #e6162d; }
		&--twitter:hover { background-color: #000; }
	}
}

// Author bio.
.author-bio {
	margin: var(--space-4) 0;
	border-radius: var(--card-radius);
	border: 1px solid var(--color-border);

	.media {
		align-items: flex-start;
	}

	&__avatar {
		border-radius: 50%;
	}

	&__name {
		display: block;
		color: var(--color-text);
		text-decoration: none;
		margin-bottom: var(--space-2);

		&:hover { color: var(--color-primary); }
	}

	&__description {
		font-size: 0.9rem;
		color: #6b7280;
		line-height: 1.6;
	}
}

// Related posts.
.related-posts {
	margin: var(--space-4) 0;

	&__title {
		margin-bottom: var(--space-3);
	}
}

.related-post-card {
	height: 100%;
	border-radius: var(--card-radius);
	border: 1px solid var(--color-border);
	overflow: hidden;
	transition:
		transform  var(--transition-base),
		box-shadow var(--transition-base);

	&:hover {
		transform: translateY(-2px);
		box-shadow: var(--card-shadow-hover);
	}

	&__image {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	&__title {
		display: block;
		font-size: 0.9rem;
		font-weight: 600;
		color: var(--color-text);
		text-decoration: none;
		line-height: 1.4;

		&:hover { color: var(--color-primary); }
	}
}

// Code block copy button wrapper.
.entry-content pre,
.post-card__content pre {
	position: relative;
}
